Skip to content

Commit

Permalink
Merge pull request rails#36883 from jhawthorn/schema_sha_fix
Browse files Browse the repository at this point in the history
Fix test schema loading for multi-db
  • Loading branch information
jhawthorn committed Aug 9, 2019
1 parent c550e71 commit 0169c93
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion activerecord/lib/active_record/migration.rb
Expand Up @@ -591,7 +591,11 @@ def load_schema_if_pending!
current_config = Base.connection_config
all_configs = ActiveRecord::Base.configurations.configs_for(env_name: Rails.env)

unless all_configs.all? { |config| Tasks::DatabaseTasks.schema_up_to_date?(config.config) }
needs_update = !all_configs.all? do |db_config|
Tasks::DatabaseTasks.schema_up_to_date?(db_config.config, ActiveRecord::Base.schema_format, nil, Rails.env, db_config.spec_name)
end

if needs_update
# Roundtrip to Rake to allow plugins to hook into database initialization.
root = defined?(ENGINE_ROOT) ? ENGINE_ROOT : Rails.root
FileUtils.cd(root) do
Expand Down

0 comments on commit 0169c93

Please sign in to comment.