diff options
author | Wojciech Wnętrzak <w.wnetrzak@gmail.com> | 2019-07-24 08:50:23 +0200 |
---|---|---|
committer | Wojciech Wnętrzak <w.wnetrzak@gmail.com> | 2019-07-24 09:19:13 +0200 |
commit | 5c1f6d1ff655a4c49ddbebe65156c08c8e853b1d (patch) | |
tree | 4a047b1af2fd72470f000690192377963a16f8fa /activerecord | |
parent | 31105c81cc82ae829c382a4eee2c5aa362882dea (diff) | |
download | rails-5c1f6d1ff655a4c49ddbebe65156c08c8e853b1d.tar.gz rails-5c1f6d1ff655a4c49ddbebe65156c08c8e853b1d.tar.bz2 rails-5c1f6d1ff655a4c49ddbebe65156c08c8e853b1d.zip |
Fixed db:prepare task to not touch schema when dump_schema_after_migration is false.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/railties/databases.rake | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index 98f57549a5..4d9acc911b 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -297,10 +297,11 @@ db_namespace = namespace :db do ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env).each do |db_config| ActiveRecord::Base.establish_connection(db_config.config) - ActiveRecord::Tasks::DatabaseTasks.migrate - # Skipped when no database - ActiveRecord::Tasks::DatabaseTasks.dump_schema(db_config.config, ActiveRecord::Base.schema_format, db_config.spec_name) + ActiveRecord::Tasks::DatabaseTasks.migrate + if ActiveRecord::Base.dump_schema_after_migration + ActiveRecord::Tasks::DatabaseTasks.dump_schema(db_config.config, ActiveRecord::Base.schema_format, db_config.spec_name) + end rescue ActiveRecord::NoDatabaseError ActiveRecord::Tasks::DatabaseTasks.create_current(db_config.env_name, db_config.spec_name) |