postgresqlherokumysqlheroku-postgres

How can I download db from heroku?


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?


Solution

  • 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