Created
January 31, 2013 16:02
-
-
Save davebrace/4683926 to your computer and use it in GitHub Desktop.
Script to restore a Heroku postgres database from one Heroku Rails app to another, assuming only one postgres database in the app. I use this to copy production databases onto staging environments.
This file contains hidden or 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 pgbackups:capture --expire -a myapp | |
heroku pg:reset `heroku config -a myapp-staging | grep -o "\w*POSTGRESQL\w*"` -a myapp-staging | |
heroku pgbackups:restore `heroku config -a myapp-staging | grep -o "\w*POSTGRESQL\w*"` `heroku pgbackups:url --app myapp` --app myapp-staging | |
heroku run rake db:migrate -a myapp-staging | |
heroku restart -a myapp-staging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment