diff options
author | Roberto Miranda <rjmaltamar@gmail.com> | 2019-04-02 16:45:37 +0100 |
---|---|---|
committer | Roberto Miranda <rjmaltamar@gmail.com> | 2019-04-02 17:04:32 +0100 |
commit | 900e566a6b8eab17a9955c9be84d2443dc837995 (patch) | |
tree | 297184340a0f531e6b5944b35db6dbb909df293d | |
parent | 098e4d25f19f2b932841401fdc5e7340876d8ff2 (diff) | |
download | rails-900e566a6b8eab17a9955c9be84d2443dc837995.tar.gz rails-900e566a6b8eab17a9955c9be84d2443dc837995.tar.bz2 rails-900e566a6b8eab17a9955c9be84d2443dc837995.zip |
💇
-rw-r--r-- | activerecord/lib/active_record/railties/databases.rake | 10 | ||||
-rw-r--r-- | railties/test/application/rake/dbs_test.rb | 2 | ||||
-rw-r--r-- | railties/test/application/rake/multi_dbs_test.rb | 1 |
3 files changed, 5 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index ef8292de2b..447def8d77 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -225,12 +225,10 @@ db_namespace = namespace :db do desc "Runs setup if database does not exist, or runs migrations if it does" task prepare: :load_config do ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).each do |db_config| - begin - ActiveRecord::Base.establish_connection(db_config.config) - db_namespace["migrate"].invoke - rescue ActiveRecord::NoDatabaseError - db_namespace["setup"].invoke - end + ActiveRecord::Base.establish_connection(db_config.config) + db_namespace["migrate"].invoke + rescue ActiveRecord::NoDatabaseError + db_namespace["setup"].invoke end end diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index ba8de8adc9..3750af4d44 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -559,7 +559,7 @@ module ApplicationTests rails "generate", "model", "book", "title:string" output = rails("db:prepare") - assert_match /CreateBooks: migrated/, output + assert_match(/CreateBooks: migrated/, output) end end end diff --git a/railties/test/application/rake/multi_dbs_test.rb b/railties/test/application/rake/multi_dbs_test.rb index 2c7cfbc0c6..147b8f94e1 100644 --- a/railties/test/application/rake/multi_dbs_test.rb +++ b/railties/test/application/rake/multi_dbs_test.rb @@ -190,7 +190,6 @@ module ApplicationTests test "db:create and db:drop works on all databases for env" do require "#{app_path}/config/environment" - ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).each do |db_config| db_create_and_drop db_config.spec_name, db_config.config["database"] end |