Skip to content

Instantly share code, notes, and snippets.

@ofirgeller
Last active April 21, 2016 00:12
Show Gist options
  • Save ofirgeller/989e87ff76f77ff46522 to your computer and use it in GitHub Desktop.
Save ofirgeller/989e87ff76f77ff46522 to your computer and use it in GitHub Desktop.
create a schme copy of a postgres database (on window)
set PGPASSWORD="<password>";
pg_dump -d "<database name>" -h "localhost" -p "5432" -U "postgres" --clean --create --schema-only --file "db_schema_copy" --format custom;
dropdb --if-exists -U postgres "<test database name>";
createdb -U "postgres" "<test database name>";
pg_restore.exe -U postgres -d "<test database name>" .\db_schema_copy;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment