Last active
August 29, 2015 13:59
-
-
Save nickgartmann/10900459 to your computer and use it in GitHub Desktop.
Bash script to capture and clone a heroku database into a local development database.
This file contains hidden or 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
if test -z $1 || test -z $2 | |
then | |
printf "Usage: clone-database heroku-app-name database-name\n" | |
exit | |
fi | |
echo "Capturing backup" | |
heroku pgbackups:capture -e -a $1 | |
echo "Pulling dump" | |
curl -o /tmp/$1-latest.dump `heroku pgbackups:url -a $1` | |
echo "Loading into local" | |
pg_restore --verbose --clean --no-acl --no-owner -h localhost -d $2 /tmp/$1-latest.dump |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment