method
structure_dump
v4.2.9 -
Show latest stable
- Class:
ActiveRecord::Tasks::PostgreSQLDatabaseTasks
structure_dump(filename)public
No documentation available.
# File activerecord/lib/active_record/tasks/postgresql_database_tasks.rb, line 45
def structure_dump(filename)
set_psql_env
args = ['-s', '-x', '-O', '-f', filename]
search_path = configuration['schema_search_path']
unless search_path.blank?
args += search_path.split(',').map do |part|
"--schema=#{part.strip}"
end
end
args << configuration['database']
run_cmd('pg_dump', args, 'dumping')
File.open(filename, "a") { |f| f << "SET search_path TO #{connection.schema_search_path};\n\n" }
end