Skip to content

Instantly share code, notes, and snippets.

@samullen
Last active December 23, 2015 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samullen/6599447 to your computer and use it in GitHub Desktop.
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>
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