method
reconstruct_from_schema
v7.1.3.2 -
Show latest stable
- Class:
ActiveRecord::Tasks::DatabaseTasks
reconstruct_from_schema(db_config, format = ActiveRecord.schema_format, file = nil)public
No documentation available.
# File activerecord/lib/active_record/tasks/database_tasks.rb, line 385
def reconstruct_from_schema(db_config, format = ActiveRecord.schema_format, file = nil) # :nodoc:
file ||= schema_dump_path(db_config, format)
check_schema_file(file) if file
with_temporary_pool(db_config, clobber: true) do
if schema_up_to_date?(db_config, format, file)
truncate_tables(db_config)
else
purge(db_config)
load_schema(db_config, format, file)
end
rescue ActiveRecord::NoDatabaseError
create(db_config)
load_schema(db_config, format, file)
end
end