Skip to content

Instantly share code, notes, and snippets.

@ufuk
Last active June 11, 2018 12:50
Show Gist options
  • Save ufuk/d1b9410d3cdd9c67f70eef21366ca008 to your computer and use it in GitHub Desktop.
Save ufuk/d1b9410d3cdd9c67f70eef21366ca008 to your computer and use it in GitHub Desktop.
Exporting and then importing full schema for PostgreSQL.
# export
PGPASSWORD="<PASSWORD>" pg_dump -U <USERNAME> -h <HOST> -d <DB_NAME> -n <SCHEMA_NAME> > export.sql
# import
PGPASSWORD="<PASSWORD>" psql -U <USERNAME> -h <HOST> -d <DB_NAME> -n <SCHEMA_NAME> -f export.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment