Skip to content

Instantly share code, notes, and snippets.

@garystafford
Last active April 18, 2022 15:39
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/d4f66348a55d5a0da5ca7c7651176b95 to your computer and use it in GitHub Desktop.
Save garystafford/d4f66348a55d5a0da5ca7c7651176b95 to your computer and use it in GitHub Desktop.
# set postgres environment variables
# ** CHANGE ME **
export PGHOST="postgres1.abcxyzdef.us-east-1.rds.amazonaws.com"
export PGPORT=5432
export PGDATABASE="postgres"
export PGUSER="admin"
export PGPASSWORD="change_me!"
# create new v1 of pagila database
export PGDATABASE="postgres"
psql -c "CREATE DATABASE pagila_v1;"
# restore original version of pagila database
pg_restore -d pagila_v1 pagila.dump
# confirm pagila tables in public schema
export PGDATABASE="pagila_v1"
psql -c "\dt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment