Skip to content

Instantly share code, notes, and snippets.

@garystafford
Last active April 11, 2022 01:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garystafford/02d2ec4b3af687466e8d1809f22a4ddf to your computer and use it in GitHub Desktop.
Save garystafford/02d2ec4b3af687466e8d1809f22a4ddf to your computer and use it in GitHub Desktop.
# dump v1 of pagila database
pg_dump -Fc -d pagila_v1 -f pagila_v1.dump
# create new v2 of pagila database
psql -c "CREATE DATABASE pagila_v2;"
# restore v1 of pagila database
pg_restore -d pagila_v2 pagila_v1.dump
# connect to new pagila database
export PGDATABASE="pagila_v2"
psql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment