Last active
November 16, 2015 11:17
-
-
Save peralmq/42e1bd0add506ae121e4 to your computer and use it in GitHub Desktop.
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/sh | |
# Create a local database and populate with data from Heroku pg:backups | |
if [ $# != 2 ]; then | |
echo 1>&2 "usage: $0 BACKUP_ID APP_NAME" | |
exit 2 | |
fi | |
BACKUP_ID=$1 | |
APP_NAME=$2 | |
BACKUP_FILE=/tmp/$BACKUP_ID.dump | |
createdb $BACKUP_ID | |
BACKUP_URL=`heroku pg:backups public-url $BACKUP_ID --app $APP_NAME` | |
wget -O $BACKUP_FILE $BACKUP_URL | |
pg_restore -d $BACKUP_ID $BACKUP_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment