Skip to content

Instantly share code, notes, and snippets.

@trankimvu
Last active June 29, 2018 05:10
Show Gist options
  • Save trankimvu/913ed73719b4b65331e9503c603e3583 to your computer and use it in GitHub Desktop.
Save trankimvu/913ed73719b4b65331e9503c603e3583 to your computer and use it in GitHub Desktop.
postgres dump and restore.sh
pg_dump --file=./dbname.20180626.tar --if-exists --clean --dbname=dbname --format=t --username=hyperloop --host=localhost --port=5432
pg_restore --dbname=dbname --clean --if-exists --single-transaction --username=hyperloop --host=localhost --port=5432 ./dbname.20180626.tar
pg_dump postgres://username:password@ec2-00-00-100-100.eu-west-1.compute.amazonaws.com:5432/databasename
#Optionally you can add -f filename to specify a local filename.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment