diff options
author | Matthew Draper <matthew@trebex.net> | 2017-02-15 00:53:30 +1030 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-15 00:53:30 +1030 |
commit | 56eba5e1023573f059adadb99449898daa32f1cc (patch) | |
tree | e767e648f67916c46885505e5ee509e613718a52 /activerecord | |
parent | e9949265d9fb6e20aa4c73f189147812db377edc (diff) | |
parent | 8a23fd4920a8f0b2b9b8c2d36c63006f46ae411b (diff) | |
download | rails-56eba5e1023573f059adadb99449898daa32f1cc.tar.gz rails-56eba5e1023573f059adadb99449898daa32f1cc.tar.bz2 rails-56eba5e1023573f059adadb99449898daa32f1cc.zip |
Merge pull request #27999 from yahonda/space_shuttles
Use ActiveRecord `bigint` type, not SQL literal bigint
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/migration/foreign_key_test.rb | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/activerecord/test/cases/migration/foreign_key_test.rb b/activerecord/test/cases/migration/foreign_key_test.rb index 2258290a3c..9d8f146693 100644 --- a/activerecord/test/cases/migration/foreign_key_test.rb +++ b/activerecord/test/cases/migration/foreign_key_test.rb @@ -94,20 +94,23 @@ if ActiveRecord::Base.connection.supports_foreign_keys? end def test_add_foreign_key_with_non_standard_primary_key - with_example_table @connection, "space_shuttles", "pk BIGINT PRIMARY KEY" do - @connection.add_foreign_key(:astronauts, :space_shuttles, - column: "rocket_id", primary_key: "pk", name: "custom_pk") + @connection.create_table :space_shuttles, id: false, force: true do |t| + t.bigint :pk, primary_key: true + end - foreign_keys = @connection.foreign_keys("astronauts") - assert_equal 1, foreign_keys.size + @connection.add_foreign_key(:astronauts, :space_shuttles, + column: "rocket_id", primary_key: "pk", name: "custom_pk") - fk = foreign_keys.first - assert_equal "astronauts", fk.from_table - assert_equal "space_shuttles", fk.to_table - assert_equal "pk", fk.primary_key + foreign_keys = @connection.foreign_keys("astronauts") + assert_equal 1, foreign_keys.size - @connection.remove_foreign_key :astronauts, name: "custom_pk" - end + fk = foreign_keys.first + assert_equal "astronauts", fk.from_table + assert_equal "space_shuttles", fk.to_table + assert_equal "pk", fk.primary_key + ensure + @connection.remove_foreign_key :astronauts, name: "custom_pk" + @connection.drop_table :space_shuttles end def test_add_on_delete_restrict_foreign_key |