diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2019-07-24 08:10:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-24 08:10:54 -0400 |
commit | 6cd364cfe5cc36b5754139967780f9f3b6ddd503 (patch) | |
tree | 373cd85394fa659cf4d1b9ea9f57488d29d8c704 /activerecord/lib | |
parent | 53d326dc5d008859b560f975c541c65748244d32 (diff) | |
parent | 5c1f6d1ff655a4c49ddbebe65156c08c8e853b1d (diff) | |
download | rails-6cd364cfe5cc36b5754139967780f9f3b6ddd503.tar.gz rails-6cd364cfe5cc36b5754139967780f9f3b6ddd503.tar.bz2 rails-6cd364cfe5cc36b5754139967780f9f3b6ddd503.zip |
Merge pull request #36744 from freeletics/fix-db-prepare
Fixed db:prepare task to not touch schema when it is disabled
Diffstat (limited to 'activerecord/lib')
-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) |