Last active
December 23, 2015 07:18
-
-
Save samullen/6599447 to your computer and use it in GitHub Desktop.
function to import heroku database into a local postgres database Usage:
heroku_import <appname> <database name>
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
function heroku_import { | |
app=$1 | |
database=$2 | |
dumpfile="/tmp/${database}.dump" | |
heroku pgbackups:capture --app $app | |
curl -o $dumpfile `heroku pgbackups:url --app ${app}` | |
pg_restore --verbose --clean --no-acl --no-owner --jobs 4 -d $database $dumpfile | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment