method
reconstruct_from_schema
v7.0.0 -
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 398
def reconstruct_from_schema(db_config, format = ActiveRecord.schema_format, file = nil) # :nodoc:
file ||= schema_dump_path(db_config, format)
check_schema_file(file)
ActiveRecord::Base.establish_connection(db_config)
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