diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-11-25 19:08:43 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-11-25 19:08:43 +0100 |
commit | 208908f00dc3e2d5826d43d086dc84153a74b0ba (patch) | |
tree | 274e89d6c34a0e6e864fbf6caa6436becfe2f716 /activerecord/lib/active_record/migration.rb | |
parent | dd986814e7f528916a44f841a02c955a4522307c (diff) | |
parent | 5c4495538bb4e8808ce077f08ea6b809952daa44 (diff) | |
download | rails-208908f00dc3e2d5826d43d086dc84153a74b0ba.tar.gz rails-208908f00dc3e2d5826d43d086dc84153a74b0ba.tar.bz2 rails-208908f00dc3e2d5826d43d086dc84153a74b0ba.zip |
Merge pull request #17739 from rails/bring_back_db_test_prepare
bring back `db:test:prepare`.
Diffstat (limited to 'activerecord/lib/active_record/migration.rb')
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 4e00eb3d99..92f2951f2d 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -395,7 +395,14 @@ module ActiveRecord def load_schema_if_pending! if ActiveRecord::Migrator.needs_migration? || !ActiveRecord::Migrator.any_migrations? - ActiveRecord::Tasks::DatabaseTasks.load_schema_current_if_exists + # Roundrip to Rake to allow plugins to hook into database initialization. + FileUtils.cd Rails.root do + current_config = Base.connection_config + Base.clear_all_connections! + system("bin/rake db:test:prepare") + # Establish a new connection, the old database may be gone (db:test:prepare uses purge) + Base.establish_connection(current_config) + end check_pending! end end |