How can I download db from heroku?

Sascuash picture Sascuash · Jun 10, 2013 · Viewed 23.4k times · Source

I'm using heroku and I want to download the database from my app(heroku) so I can make some changes in it, I've installed pgbackups, but using heroku pgbackups:url downloads a .dump file

How can I download a postgresql file or translate that .dump into a postgresql file?

Answer

AlexQueue picture AlexQueue · Jun 13, 2013

If you're using Heroku's pgbackups (which you probably should be using):

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

"Translate" it into a postgres db with

$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump

See https://devcenter.heroku.com/articles/heroku-postgres-import-export