Skip to content

Instantly share code, notes, and snippets.

@mistrikushal
Last active September 18, 2017 18:05
Show Gist options
  • Save mistrikushal/fbc92f35d160d9a6f7410597d76a3985 to your computer and use it in GitHub Desktop.
Save mistrikushal/fbc92f35d160d9a6f7410597d76a3985 to your computer and use it in GitHub Desktop.
Heroku PG backup and restore
# heroku pg restore from first app
$ heroku pg:backups:capture --app sushi
# download the backup (optional)
$ heroku pg:backups:url b001 --app sushi
# in above command b001 is the ID of a backup which will be displayed on terminal once backup is done
# check the backup information
$ heroku pg:backups:info b017 --app sushi
# delete the backup (optional)
$ heroku pg:backups:delete b101 --app foo
# 2 ways to restore a backup
# 1 - within same application
$ heroku pg:backups:restore b101 DATABASE_URL --app sushi
# 2 - from one application to another application(e.g production -> staging or staging -> development)
$ heroku pg:backups:restore sushi::b101 DATABASE_URL --app sushi-staging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment