Skip to content

Commit 9ef7938

Browse files
committed
Remove deprecated support to passing SchemaMigration and InternalMetadata classes as arguments to ActiveRecord::MigrationContext.
1 parent 02f66fe commit 9ef7938

File tree

4 files changed

+8
-38
lines changed

4 files changed

+8
-38
lines changed

activerecord/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
* Remove deprecated support to passing `SchemaMigration` and `InternalMetadata` classes as arguments to
2+
`ActiveRecord::MigrationContext`.
3+
4+
*Rafael Mendonça França*
5+
16
* Remove deprecated `ActiveRecord::Migration.check_pending` method.
27

38
*Rafael Mendonça França*

activerecord/lib/active_record/migration.rb

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,28 +1205,6 @@ class MigrationContext
12051205
attr_reader :migrations_paths, :schema_migration, :internal_metadata
12061206

12071207
def initialize(migrations_paths, schema_migration = nil, internal_metadata = nil)
1208-
if schema_migration == SchemaMigration
1209-
ActiveRecord.deprecator.warn(<<-MSG.squish)
1210-
SchemaMigration no longer inherits from ActiveRecord::Base. If you want
1211-
to use the default connection, remove this argument. If you want to use a
1212-
specific connection, instantiate MigrationContext with the connection's schema
1213-
migration, for example `MigrationContext.new(path, Dog.connection.schema_migration)`.
1214-
MSG
1215-
1216-
schema_migration = nil
1217-
end
1218-
1219-
if internal_metadata == InternalMetadata
1220-
ActiveRecord.deprecator.warn(<<-MSG.squish)
1221-
SchemaMigration no longer inherits from ActiveRecord::Base. If you want
1222-
to use the default connection, remove this argument. If you want to use a
1223-
specific connection, instantiate MigrationContext with the connection's internal
1224-
metadata, for example `MigrationContext.new(path, nil, Dog.connection.internal_metadata)`.
1225-
MSG
1226-
1227-
internal_metadata = nil
1228-
end
1229-
12301208
@migrations_paths = migrations_paths
12311209
@schema_migration = schema_migration || SchemaMigration.new(connection)
12321210
@internal_metadata = internal_metadata || InternalMetadata.new(connection)

activerecord/test/cases/migration_test.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,6 @@ def setup
7979
ActiveRecord::Migration.verbose = @verbose_was
8080
end
8181

82-
def test_passing_a_schema_migration_class_to_migration_context_is_deprecated
83-
migrations_path = MIGRATIONS_ROOT + "/valid"
84-
migrator = assert_deprecated(ActiveRecord.deprecator) { ActiveRecord::MigrationContext.new(migrations_path, ActiveRecord::SchemaMigration, ActiveRecord::InternalMetadata) }
85-
migrator.up
86-
87-
assert_equal 3, migrator.current_version
88-
assert_equal false, migrator.needs_migration?
89-
90-
migrator.down
91-
assert_equal 0, migrator.current_version
92-
assert_equal true, migrator.needs_migration?
93-
94-
@schema_migration.create_version(3)
95-
assert_equal true, migrator.needs_migration?
96-
end
97-
9882
def test_migration_context_with_default_schema_migration
9983
migrations_path = MIGRATIONS_ROOT + "/valid"
10084
migrator = ActiveRecord::MigrationContext.new(migrations_path)

guides/source/7_2_release_notes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ Please refer to the [Changelog][active-record] for detailed changes.
131131

132132
* Remove deprecated `ActiveRecord::Migration.check_pending` method.
133133

134+
* Remove deprecated support to passing `SchemaMigration` and `InternalMetadata` classes as arguments to
135+
`ActiveRecord::MigrationContext`.
136+
134137
### Deprecations
135138

136139
### Notable changes

0 commit comments

Comments
 (0)