Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.