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 that database locally to reproduce bugs can be done with the helper web/bin/pg_restore_heroku_local:
web/bin/pg_restore_heroku_local
Restoring that local database dump to Heroku when reverting back isuses can be done with the helper web/bin/pg_restore_heroku_remote:This will then ask you to type an interactive confirmation which we have not disabled by default.
web/bin/pg_restore_heroku_remote
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