1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix structure:dump for multiple databases

ccea4cf broke multiple database structure:dump, the current_config line
should have been deleted instead. I'm struggling to write a test for
this since the confings are passed from rake to the structure_dump
method rather than the other way around. Hoping to come up with a test
while I work on structure:load commands for multiple databases.
This commit is contained in:
eileencodes 2018-04-06 09:36:07 -04:00
parent 475a2911bb
commit 0a353a9786

View file

@ -317,8 +317,7 @@ db_namespace = namespace :db do
ActiveRecord::DatabaseConfigurations.configs_for(Rails.env) do |spec_name, config| ActiveRecord::DatabaseConfigurations.configs_for(Rails.env) do |spec_name, config|
ActiveRecord::Base.establish_connection(config) ActiveRecord::Base.establish_connection(config)
filename = ActiveRecord::Tasks::DatabaseTasks.dump_filename(spec_name, :sql) filename = ActiveRecord::Tasks::DatabaseTasks.dump_filename(spec_name, :sql)
current_config = ActiveRecord::Tasks::DatabaseTasks.current_config ActiveRecord::Tasks::DatabaseTasks.structure_dump(config, filename)
ActiveRecord::Tasks::DatabaseTasks.structure_dump(current_config, filename)
if ActiveRecord::SchemaMigration.table_exists? if ActiveRecord::SchemaMigration.table_exists?
File.open(filename, "a") do |f| File.open(filename, "a") do |f|