method
prepare_all
v7.2.3 -
Show latest stable
- Class:
ActiveRecord::Tasks::DatabaseTasks
prepare_all()public
No documentation available.
# File activerecord/lib/active_record/tasks/database_tasks.rb, line 176
def prepare_all
seed = false
dump_db_configs = []
each_current_configuration(env) do |db_config|
with_temporary_pool(db_config) do
begin
database_initialized = migration_connection_pool.schema_migration.table_exists?
rescue ActiveRecord::NoDatabaseError
create(db_config)
retry
end
unless database_initialized
if File.exist?(schema_dump_path(db_config))
load_schema(db_config, ActiveRecord.schema_format, nil)
end
seed = true
end
end
end
each_current_environment(env) do |environment|
db_configs_with_versions(environment).sort.each do |version, db_configs|
dump_db_configs |= db_configs
db_configs.each do |db_config|
with_temporary_pool(db_config) do
migrate(version)
end
end
end
end
# Dump schema for databases that were migrated.
if ActiveRecord.dump_schema_after_migration
dump_db_configs.each do |db_config|
with_temporary_pool(db_config) do
dump_schema(db_config)
end
end
end
load_seed if seed
end