Skip to content

Instantly share code, notes, and snippets.

@guisehn
Forked from wrburgess/gist:5528649
Last active June 2, 2021 11:08
Show Gist options
  • Save guisehn/6648c8fdcd1102a22a22 to your computer and use it in GitHub Desktop.
Save guisehn/6648c8fdcd1102a22a22 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

@danjohnson3141
Copy link

This was very helpful. Thanks for writing it. +1

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