Skip to content

Commit 02f66fe

Browse files
committed
Remove deprecated ActiveRecord::Migration.check_pending method
1 parent e509a0e commit 02f66fe

File tree

4 files changed

+6
-41
lines changed

4 files changed

+6
-41
lines changed

activerecord/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Remove deprecated `ActiveRecord::Migration.check_pending` method.
2+
3+
*Rafael Mendonça França*
4+
15
* Remove deprecated `ActiveRecord::LogSubscriber.runtime` method.
26

37
*Rafael Mendonça França*

activerecord/lib/active_record/migration.rb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -696,23 +696,6 @@ def nearest_delegate # :nodoc:
696696
delegate || superclass.nearest_delegate
697697
end
698698

699-
# Raises ActiveRecord::PendingMigrationError error if any migrations are pending.
700-
#
701-
# This is deprecated in favor of +check_all_pending!+
702-
def check_pending!(connection = ActiveRecord::Tasks::DatabaseTasks.migration_connection)
703-
ActiveRecord.deprecator.warn(<<-MSG.squish)
704-
The `check_pending!` method is deprecated in favor of `check_all_pending!`. The
705-
new implementation will loop through all available database configurations and find
706-
pending migrations. The prior implementation did not permit this.
707-
MSG
708-
709-
pending_migrations = connection.migration_context.open.pending_migrations
710-
711-
if pending_migrations.any?
712-
raise ActiveRecord::PendingMigrationError.new(pending_migrations: pending_migrations)
713-
end
714-
end
715-
716699
# Raises ActiveRecord::PendingMigrationError error if any migrations are pending
717700
# for all database configurations in an environment.
718701
def check_all_pending!

activerecord/test/cases/migration/pending_migrations_test.rb

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ def test_errors_if_pending
4444
assert_pending_migrations("01_create_foo.rb")
4545
end
4646

47-
def test_errors_if_pending_with_deprecated_method
48-
create_migration "01", "create_foo"
49-
assert_deprecated_check_pending("01_create_foo.rb")
50-
end
51-
5247
def test_checks_if_supported
5348
run_migrations
5449
assert_no_pending_migrations
@@ -92,25 +87,6 @@ def test_with_stdlib_logger
9287
end
9388

9489
private
95-
def assert_deprecated_check_pending(*expected_migrations)
96-
2.times do
97-
assert_raises ActiveRecord::PendingMigrationError do
98-
assert_deprecated(ActiveRecord.deprecator) do
99-
ActiveRecord::Migration.check_pending!
100-
end
101-
end
102-
103-
error = assert_raises ActiveRecord::PendingMigrationError do
104-
CheckPending.new(proc { flunk }).call({})
105-
end
106-
107-
assert_includes error.message, "Migrations are pending."
108-
expected_migrations.each do |migration|
109-
assert_includes error.message, migration
110-
end
111-
end
112-
end
113-
11490
def assert_pending_migrations(*expected_migrations)
11591
2.times do
11692
assert_raises ActiveRecord::PendingMigrationError do

guides/source/7_2_release_notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ Please refer to the [Changelog][active-record] for detailed changes.
129129

130130
* Remove deprecated `ActiveRecord::LogSubscriber.reset_runtime` method.
131131

132+
* Remove deprecated `ActiveRecord::Migration.check_pending` method.
133+
132134
### Deprecations
133135

134136
### Notable changes

0 commit comments

Comments
 (0)