acsbpw
Last Updated: February 25, 2016
·
596
· nicolaslazartekaqui
Img 3566

Heroku - Export postgres database

Add addon pgbackups

$ heroku addons:add pgbackups

now create a dump

$ heroku pgbackups:capture

then download dump file using curl

$ curl -o latest.dump `heroku pgbackups:url`

If you don't do in project dir use --app <APP>

Only inserts?

import

$ pg_restore --verbose --clean --no-acl --no-owner -d dbname latest.dump

then export

$ pg_dump --data-only --column-inserts --file=inserts.dump dbname

if you want file in sql, add -Fp --file=inserts.sql.

Say Thanks
Respond