Last active
November 22, 2017 17:22
-
-
Save gabrielbidula/5663c29b73399cf29d7afce42c7da724 to your computer and use it in GitHub Desktop.
capture and restore backup from heroku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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