diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-06-11 11:35:26 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-06-26 22:03:49 +0200 |
commit | 0938d5305758dfcbec4e813c777bb627e82a5906 (patch) | |
tree | 7739228701950754fb612f9f2d648d0bf1f07d51 /activerecord/test | |
parent | 9ae1a2c69f51a9065090a9c505f4d22ffbb84094 (diff) | |
download | rails-0938d5305758dfcbec4e813c777bb627e82a5906.tar.gz rails-0938d5305758dfcbec4e813c777bb627e82a5906.tar.bz2 rails-0938d5305758dfcbec4e813c777bb627e82a5906.zip |
fk: dump foreign keys at the bottom to make sure tables exist.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/schema_dumper_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb index b1e7420c66..4e71d04bc0 100644 --- a/activerecord/test/cases/schema_dumper_test.rb +++ b/activerecord/test/cases/schema_dumper_test.rb @@ -372,6 +372,13 @@ class SchemaDumperTest < ActiveRecord::TestCase assert_match %r{create_table "subscribers", id: false}, output end + if ActiveRecord::Base.connection.supports_foreign_keys? + def test_foreign_keys_are_dumped_at_the_bottom_to_circumvent_dependency_issues + output = standard_dump + assert_match(/^\s+add_foreign_key "fk_test_has_fk"[^\n]+\n\s+add_foreign_key "lessons_students"/, output) + end + end + class CreateDogMigration < ActiveRecord::Migration def up create_table("dog_owners") do |t| |