Skip to content

Instantly share code, notes, and snippets.

@jeanbaptistebeck
Last active March 11, 2016 18:34
Show Gist options
  • Save jeanbaptistebeck/80e564f16457b31f4853 to your computer and use it in GitHub Desktop.
Save jeanbaptistebeck/80e564f16457b31f4853 to your computer and use it in GitHub Desktop.
Import Heroku Postgres database into local database

Import Heroku Postgres database into local database

heroku pg:backups capture
curl -o latest.dump `heroku pg:backups public-url`

If you didn't create a role for your local database, then do :

createuser -s -r <role_name>

NB : the database name and roles can be found in the `database.yml' file

pg_restore --verbose --clean --no-acl --no-owner -h localhost -U <role_name> -d <database_name> latest.dump
@nicknem
Copy link

nicknem commented Mar 11, 2016

Why do you need to create a role?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment