Created
March 3, 2017 13:19
-
-
Save jnicho02/d995dd86be427f0023aa961c99724f2a to your computer and use it in GitHub Desktop.
a really useful script for Heroku + Rails. Generate a db backup, download it, create a new db, import data, update database config to point at it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heroku pg:backups capture --app open-plaques-beta | |
curl -o db/db.dump `heroku pg:backups --app open-plaques-beta public-url` | |
createdb openplaques_$(date +'%Y-%m-%d') | |
pg_restore -d openplaques_$(date +'%Y-%m-%d') db/db.dump | |
sed -iE "s/openplaques_[0-9|-]*/openplaques_$(date +'%Y-%m-%d')/g" config/database.yml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment