-
-
Save wwerner/dd8435676a358cff40edbde883a4392a to your computer and use it in GitHub Desktop.
Dump Heroku Postgres DB and load locally into postgres
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
Get the Heroku db as detailed here: | |
http://devcenter.heroku.com/articles/pgbackups#exporting_via_a_backup | |
$ heroku pg:backups:capture # outputs backup_num in the last line | |
$ heroku pg:backups:url <backup_num> #=> backup_url | |
$ curl -o /tmp/latest.dump <backup_url> | |
Then locally do: | |
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb /tmp/latest.dump | |
(your database must exist before can do this) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment