Skip to content

Instantly share code, notes, and snippets.

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 korymath/1c1c4a8a7aabce4b1882cbfc7906b079 to your computer and use it in GitHub Desktop.
Save korymath/1c1c4a8a7aabce4b1882cbfc7906b079 to your computer and use it in GitHub Desktop.
Backup Heroku Postgres database and restore to local database

Grab new backup

Command: heroku pg:backups capture -a [app_name]

Download

Command: curl -o latest.dump `heroku pg:backups public-url -a [app_name]`

Restore backup dump into local db

Command: pg_restore --verbose --clean --no-acl --no-owner -h localhost -d [db_name] latest.dump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment