diff options
author | Andrew White <pixeltrix@users.noreply.github.com> | 2017-01-17 15:24:17 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-17 15:24:17 +0000 |
commit | d665c611096ece7579475e381bfe45235515e8fb (patch) | |
tree | 353403787a9b5ec77cbea0606fd10282bc60ba53 /activerecord/test/cases/migration/references_foreign_key_test.rb | |
parent | ab91a2be3aef3e2ca3bf4201186cde0afbbf7cf5 (diff) | |
parent | 24f264e9ca0f1ce3b16392b8ee6360480251f556 (diff) | |
download | rails-d665c611096ece7579475e381bfe45235515e8fb.tar.gz rails-d665c611096ece7579475e381bfe45235515e8fb.tar.bz2 rails-d665c611096ece7579475e381bfe45235515e8fb.zip |
Merge pull request #24743 from kamipo/sqlite_foreing_key_support
SQLite: Foreign Key Support
Diffstat (limited to 'activerecord/test/cases/migration/references_foreign_key_test.rb')
-rw-r--r-- | activerecord/test/cases/migration/references_foreign_key_test.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/activerecord/test/cases/migration/references_foreign_key_test.rb b/activerecord/test/cases/migration/references_foreign_key_test.rb index 4957ab8b3d..560adcbfed 100644 --- a/activerecord/test/cases/migration/references_foreign_key_test.rb +++ b/activerecord/test/cases/migration/references_foreign_key_test.rb @@ -1,9 +1,9 @@ require "cases/helper" -if ActiveRecord::Base.connection.supports_foreign_keys? +if ActiveRecord::Base.connection.supports_foreign_keys_in_create? module ActiveRecord class Migration - class ReferencesForeignKeyTest < ActiveRecord::TestCase + class ReferencesForeignKeyInCreateTest < ActiveRecord::TestCase setup do @connection = ActiveRecord::Base.connection @connection.create_table(:testing_parents, force: true) @@ -61,6 +61,24 @@ if ActiveRecord::Base.connection.supports_foreign_keys? assert_equal([["testings", "testing_parents", "parent_id"]], fks.map { |fk| [fk.from_table, fk.to_table, fk.column] }) end + end + end + end +end + +if ActiveRecord::Base.connection.supports_foreign_keys? + module ActiveRecord + class Migration + class ReferencesForeignKeyTest < ActiveRecord::TestCase + setup do + @connection = ActiveRecord::Base.connection + @connection.create_table(:testing_parents, force: true) + end + + teardown do + @connection.drop_table "testings", if_exists: true + @connection.drop_table "testing_parents", if_exists: true + end test "foreign keys cannot be added to polymorphic relations when creating the table" do @connection.create_table :testings do |t| |