Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidfurlong/772b351312ef5ce74c4acbb80352df7b to your computer and use it in GitHub Desktop.
Save davidfurlong/772b351312ef5ce74c4acbb80352df7b to your computer and use it in GitHub Desktop.
Restoring a production heroku postgres backup into a local postgres instance on OSX
0. Make sure your Postgres version is the same as the heroku one (even minor version)
1. Download heroku backup
2. Add .dump extension to the file
3. Run
$ pg_restore -f mydatabase.sql mydatabase.dump
to convert sql dump to sql.
4. Find the 'Owner' name in the file and replace all with your localhost Owner (find by using \l and finding the owner of local database's Name)
5. psql databasename
6. \i mydatabasedump.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment