diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-08-16 20:46:37 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-08-16 20:46:37 +0900 |
commit | b40fbb5f9520ea2280a1deceaea8980fc620ac46 (patch) | |
tree | 669385db5044271937b42c26d8bc9ccd7c5715a6 /activerecord/test/cases | |
parent | 3ef3a921797c514ac48a019bfb229de200f1ba77 (diff) | |
parent | 33ce73edf1d1b02f4f50fc5d7565590468167d76 (diff) | |
download | rails-b40fbb5f9520ea2280a1deceaea8980fc620ac46.tar.gz rails-b40fbb5f9520ea2280a1deceaea8980fc620ac46.tar.bz2 rails-b40fbb5f9520ea2280a1deceaea8980fc620ac46.zip |
Merge pull request #33585 from yahonda/diag33520
SQLite3 adapter `alter_table` method restores foreign keys
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/migration/foreign_key_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration/foreign_key_test.rb b/activerecord/test/cases/migration/foreign_key_test.rb index c471dd1106..7b755787c7 100644 --- a/activerecord/test/cases/migration/foreign_key_test.rb +++ b/activerecord/test/cases/migration/foreign_key_test.rb @@ -64,6 +64,19 @@ if ActiveRecord::Base.connection.supports_foreign_keys_in_create? assert_equal "astronauts", fk.from_table assert_equal "rockets", fk.to_table end + + def test_rename_column_of_child_table + rocket = Rocket.create!(name: "myrocket") + rocket.astronauts << Astronaut.create! + + @connection.rename_column :astronauts, :name, :astronaut_name + + foreign_keys = @connection.foreign_keys("astronauts") + fk = foreign_keys.first + assert_equal "myrocket", Rocket.first.name + assert_equal "astronauts", fk.from_table + assert_equal "rockets", fk.to_table + end end end end |