File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
lib/active_record/migration Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ class V4_2 < V5_0
102
102
module Legacy
103
103
include FourTwoShared
104
104
105
- def run ( *)
105
+ def migrate ( *)
106
106
ActiveSupport ::Deprecation . warn \
107
107
"Directly inheriting from ActiveRecord::Migration is deprecated. " \
108
108
"Please specify the Rails release the migration was written for:\n " \
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def setup
21
21
teardown do
22
22
connection . drop_table :testings rescue nil
23
23
ActiveRecord ::Migration . verbose = @verbose_was
24
- ActiveRecord ::SchemaMigration . delete_all
24
+ ActiveRecord ::SchemaMigration . delete_all rescue nil
25
25
end
26
26
27
27
def test_migration_doesnt_remove_named_index
@@ -101,6 +101,18 @@ def migrate(x)
101
101
assert connection . columns ( :testings ) . find { |c | c . name == 'created_at' } . null
102
102
assert connection . columns ( :testings ) . find { |c | c . name == 'updated_at' } . null
103
103
end
104
+
105
+ def test_legacy_migrations_get_deprecation_warning_when_run
106
+ migration = Class . new ( ActiveRecord ::Migration ) {
107
+ def up
108
+ add_column :testings , :baz , :string
109
+ end
110
+ }
111
+
112
+ assert_deprecated do
113
+ migration . migrate :up
114
+ end
115
+ end
104
116
end
105
117
end
106
118
end
You can’t perform that action at this time.
0 commit comments