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

Call method locally inside the class

This commit is contained in:
Rafael Mendonça França 2020-12-29 22:10:59 +00:00
parent ead9b764d2
commit 5b9505871b
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948

View file

@ -197,34 +197,34 @@ module ActiveRecord
def prepare_all def prepare_all
seed = false seed = false
configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env).each do |db_config| configs_for(env_name: env).each do |db_config|
ActiveRecord::Base.establish_connection(db_config) ActiveRecord::Base.establish_connection(db_config)
# Skipped when no database # Skipped when no database
ActiveRecord::Tasks::DatabaseTasks.migrate migrate
if ActiveRecord::Base.dump_schema_after_migration if ActiveRecord::Base.dump_schema_after_migration
ActiveRecord::Tasks::DatabaseTasks.dump_schema(db_config, ActiveRecord::Base.schema_format) dump_schema(db_config, ActiveRecord::Base.schema_format)
end end
rescue ActiveRecord::NoDatabaseError rescue ActiveRecord::NoDatabaseError
config_name = db_config.name config_name = db_config.name
ActiveRecord::Tasks::DatabaseTasks.create_current(db_config.env_name, config_name) create_current(db_config.env_name, config_name)
if File.exist?(ActiveRecord::Tasks::DatabaseTasks.dump_filename(config_name)) if File.exist?(dump_filename(config_name))
ActiveRecord::Tasks::DatabaseTasks.load_schema( load_schema(
db_config, db_config,
ActiveRecord::Base.schema_format, ActiveRecord::Base.schema_format,
nil nil
) )
else else
ActiveRecord::Tasks::DatabaseTasks.migrate migrate
end end
seed = true seed = true
end end
ActiveRecord::Base.establish_connection ActiveRecord::Base.establish_connection
ActiveRecord::Tasks::DatabaseTasks.load_seed if seed load_seed if seed
end end
def drop(configuration, *arguments) def drop(configuration, *arguments)