Last active
December 27, 2015 14:09
-
-
Save michrome/7338334 to your computer and use it in GitHub Desktop.
Capture a Postgres backup from Heroku and restore it to a local development database
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 | |
# Capture a backup | |
heroku pgbackups:capture | |
# Download the backup | |
curl -o latest.dump `heroku pgbackups:url` | |
# Restore the back locally | |
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U `whoami` -d `echo ${PWD##*/}_development` latest.dump |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment