Merge pull request #36883 from jhawthorn/schema_sha_fix

Fix test schema loading for multi-db
This commit is contained in:
John Hawthorn 2019-08-07 14:52:03 -07:00 committed by GitHub
commit 646dd8c51f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -590,7 +590,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