1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Should work foreign key in test schema without if supports_foreign_keys? statement

If an adapter does not support foreign key feature, should be noop.

https://github.com/rails/rails/blob/v5.0.0.rc1/activerecord/test/cases/migration/foreign_key_test.rb#L288-L294
https://github.com/rails/rails/blob/v5.0.0.rc1/activerecord/test/cases/migration/references_foreign_key_test.rb#L208-L214
This commit is contained in:
Ryuta Kamizono 2016-05-12 07:47:28 +09:00
parent dc01a40eac
commit b0923e4ca2
2 changed files with 7 additions and 9 deletions

View file

@ -343,7 +343,7 @@ class SchemaDumperTest < ActiveRecord::TestCase
t.column :name, :string
t.column :owner_id, :bigint
t.index [:name]
t.foreign_key :dog_owners, column: "owner_id" if supports_foreign_keys?
t.foreign_key :dog_owners, column: "owner_id"
end
end
def down

View file

@ -1005,16 +1005,14 @@ ActiveRecord::Schema.define do
create_table :records, force: true do |t|
end
if supports_foreign_keys?
# fk_test_has_fk should be before fk_test_has_pk
disable_referential_integrity do
create_table :fk_test_has_pk, primary_key: "pk_id", force: :cascade do |t|
end
create_table :fk_test_has_fk, force: true do |t|
t.bigint :fk_id, null: false
t.references :fk, null: false
t.foreign_key :fk_test_has_pk, column: "fk_id", name: "fk_name", primary_key: "pk_id"
end
create_table :fk_test_has_pk, force: true, primary_key: "pk_id" do |t|
end
add_foreign_key :fk_test_has_fk, :fk_test_has_pk, column: "fk_id", name: "fk_name", primary_key: "pk_id"
end
create_table :overloaded_types, force: true do |t|