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
.
Written by Nícolas Lazarte Kaqui
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Heroku
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#