First download a dump of the database as per devcenter.heroku.com/articles/heroku-postgres-import-export with web/bin/pg_dump_heroku:
This produces a file
web/bin/pg_dump_heroku
latest.dump
with the database dump. If that already exists, it gets overwritten.Restoring can be done with the helper web/bin/pg_restore_heroku:
web/bin/pg_restore_heroku
That helper restore the local
We also add some extra flags to reduce the ammount of warnings and errors due to database differences. The command does not exit with status 0. devcenter.heroku.com/articles/heroku-postgres-import-export says some of those warnings are normal and can be ignored.
latest.dump
database file like in Section "Save and restore local PostgreSQL development database". First we nuke the database completely with web/bin/pg-setup to increase accuracy:
web/bin/pg-setup
web/bin/pg_restore --no-acl --no-owner latest.dump