Skip to content

Instantly share code, notes, and snippets.

@gentilfp
Created February 7, 2015 10:37
Show Gist options
  • Save gentilfp/76fc75fbf3853d95eb32 to your computer and use it in GitHub Desktop.
Save gentilfp/76fc75fbf3853d95eb32 to your computer and use it in GitHub Desktop.
Importing and Exporting Heroku database
# Export
$ heroku pgbackups:capture
$ curl -o latest.dump `heroku pgbackups:url --app APP`
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump
# Import
$ PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump
$ heroku pgbackups:restore DATABASE 'https://s3.amazonaws.com/me/items/3H0q/mydb.dump'
https://devcenter.heroku.com/articles/heroku-postgres-import-export
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment