File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -1044,7 +1044,9 @@ def migration
1044
1044
end
1045
1045
1046
1046
def load_migration
1047
- require ( File . expand_path ( filename ) )
1047
+ Object . send ( :remove_const , name ) rescue nil
1048
+
1049
+ load ( File . expand_path ( filename ) )
1048
1050
name . constantize . new ( name , version )
1049
1051
end
1050
1052
end
Original file line number Diff line number Diff line change 15
15
require MIGRATIONS_ROOT + "/rename/2_rename_things"
16
16
require MIGRATIONS_ROOT + "/decimal/1_give_me_big_numbers"
17
17
18
+ class ValidPeopleHaveLastNames < ActiveRecord ::Migration ::Current
19
+ def change
20
+ drop_table :people
21
+ end
22
+ end
23
+
18
24
class BigNumber < ActiveRecord ::Base
19
25
unless current_adapter? ( :PostgreSQLAdapter , :SQLite3Adapter )
20
26
attribute :value_of_e , :integer
@@ -108,6 +114,14 @@ def test_migrator_versions
108
114
assert_equal true , migrator . needs_migration?
109
115
end
110
116
117
+ def test_name_collision_across_dbs
118
+ migrations_path = MIGRATIONS_ROOT + "/valid"
119
+ migrator = ActiveRecord ::MigrationContext . new ( migrations_path )
120
+ migrator . up
121
+
122
+ assert_column Person , :last_name
123
+ end
124
+
111
125
def test_migration_detection_without_schema_migration_table
112
126
ActiveRecord ::Base . connection . drop_table "schema_migrations" , if_exists : true
113
127
You can’t perform that action at this time.
0 commit comments