Skip to content

Instantly share code, notes, and snippets.

@heatherm
Last active November 24, 2015 20:30
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 heatherm/c7cd93be01ea0ae90436 to your computer and use it in GitHub Desktop.
Save heatherm/c7cd93be01ea0ae90436 to your computer and use it in GitHub Desktop.
Heroku PG Backups - Restore to Staging or Local
heroku pg:backups capture --app production
heroku pg:backups --app production
*note the code for the latest backup* (ex: b017)
PROD -> STAGING
heroku pg:backups restore `heroku pg:backups public-url b017 --app production` DATABASE --app staging
PROD -> LOCAL
curl -o latest.dump `heroku pg:backups public-url b017 --app production`
pg_restore --verbose --clean --no-acl --no-owner -h localhost -d db_name latest.dump
@bion
Copy link

bion commented Nov 24, 2015

@heatherm heroku pg:pull DATABASE_URL tss_development -r production

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