Created
July 23, 2013 19:14
-
-
Save ewalk153/6065269 to your computer and use it in GitHub Desktop.
heroku and postgres script to restore from the latest backup
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
#!/bin/sh | |
DIR="$(basename $(PWD))" | |
DIR="${DIR/-/_}" | |
if [ "$1" == "execute" ] | |
then | |
if [ ! -f 'dump.db' ] | |
then | |
echo "downloading backup" | |
curl `heroku pgbackups:url` > dump.db | |
fi | |
pg_restore --verbose --clean --no-acl --no-owner -d $DIR dump.db | |
echo "restore complete. Run rake tasks to update any necessary db changes" | |
else | |
echo "add execute to run" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment