Skip to content

Instantly share code, notes, and snippets.

@seanbehan
Last active January 23, 2018 03:16
Show Gist options
  • Save seanbehan/c395e84e1844d366722c to your computer and use it in GitHub Desktop.
Save seanbehan/c395e84e1844d366722c to your computer and use it in GitHub Desktop.
Export and import a Heroku database from one app to another app
heroku addons:create heroku-postgresql:hobby-basic
heroku pg:wait
heroku info
heroku pg:backups capture
heroku maintenance:on
export DB_DUMP=`heroku pg:backups public-url -a export-app-name`
heroku pg:backups restore $DB_DUMP DATABASE_URL -a import-app-name
heroku pg:copy DATABASE_URL HEROKU_POSTGRESQL_PURPLE_URL
heroku pg:promote HEROKU_POSTGRESQL_PURPLE_URL
heroku maintenance:off
heroku pg:info
export DB_DUMP=`heroku pg:backups public-url -a export-app-name`
heroku pg:backups restore $DB_DUMP DATABASE_URL -a import-app-name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment