Skip to content

Instantly share code, notes, and snippets.

@brettchalupa
Forked from wrburgess/gist:5528649
Last active January 13, 2017 03:23
Show Gist options
  • Save brettchalupa/e14a8dbce2765c9aef13 to your computer and use it in GitHub Desktop.
Save brettchalupa/e14a8dbce2765c9aef13 to your computer and use it in GitHub Desktop.
Backup Heroku Postgres database and restore to local database

How To Use Heroku Postgresql Database Locally

https://devcenter.heroku.com/articles/heroku-postgres-import-export

or

  1. Create a new database backup - heroku pg:backups capture
  2. Request and copy the URL - heroku pg:backups public-url
  3. Download the database backup - curl "[the url]" > tmp/db.dump
  4. Restore the backup - pg_restore --verbose --clean --no-acl --no-owner -h localhost -d [db_name] tmp/db.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment