Skip to content

Instantly share code, notes, and snippets.

@gabrielbidula
Last active November 22, 2017 17:22
Show Gist options
  • Save gabrielbidula/5663c29b73399cf29d7afce42c7da724 to your computer and use it in GitHub Desktop.
Save gabrielbidula/5663c29b73399cf29d7afce42c7da724 to your computer and use it in GitHub Desktop.
capture and restore backup from heroku
#!/bin/bash
HEROKU_APP_NAME="XXX"
LOCAL_DATABASE="XXX"
heroku pg:backups capture DATABASE_URL --app $HEROKU_APP_NAME
curl -o production.dump `heroku pg:backups public-url --app $HEROKU_APP_NAME`
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U $(whoami) -d $LOCAL_DATABASE production.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment