Skip to content

Instantly share code, notes, and snippets.

@olvap
Forked from abhishek77in/heroku-db.sh
Created September 27, 2016 16:59
Show Gist options
  • Select an option

  • Save olvap/eebd47a684eff6ac08c09a66e4b91041 to your computer and use it in GitHub Desktop.

Select an option

Save olvap/eebd47a684eff6ac08c09a66e4b91041 to your computer and use it in GitHub Desktop.
Import heroku database to local machine
heroku pg:backups capture --app sushi
curl -o latest.dump `heroku pg:backups public-url --app sushi`
pg_restore --verbose --clean --no-acl --no-owner -d <app_name>_development latest.dump
# To copy prodcution data to staging app
heroku pg:backups restore `heroku pgbackups:url -a production-app` DATABASE -a staging-app
# Store prodcution data to staging
heroku pg:backups restore `heroku pgbackups:url -a production-app` DATABASE -a staging-app
heroku pg:backups restore b001 DATABASE_URL --app sushi
heroku pg:copy DATABASE_URL HEROKU_POSTGRESQL_PINK_URL --app sushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment