Created
July 8, 2013 17:55
-
-
Save grobertson/5950950 to your computer and use it in GitHub Desktop.
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/bash | |
if [[ -z "$1" ]]; then | |
FAIL=1 | |
elif [[ -z "$2" ]]; then | |
FAIL=1 | |
fi | |
if [[ -n "$FAIL" ]];then | |
echo "Usage: $0 SOURCE DESTINATION" | |
echo "Where SOURCE and DESTINATION are Heroku app names." | |
exit 1 | |
fi | |
SOURCE=$1 | |
DESTINATION=$2 | |
#Never allow this script to restore to the dailydot app for safety. | |
if [ "$DESTINATION" = "dailydot" ]; then | |
echo "Cowardly refusing to restore to the production app. You're on your own, buddy." | |
exit 1 | |
else | |
echo "Restoring backup of $SOURCE to $DESTINATION" | |
heroku pgbackups:restore DATABASE_URL -a $DESTINATION `heroku pgbackups:url -a $SOURCE` --confirm $DESTINATION | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment