Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sunloverz/70575d09e67638c9b55ea53005ceafeb to your computer and use it in GitHub Desktop.
Save sunloverz/70575d09e67638c9b55ea53005ceafeb 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