Created
August 27, 2020 11:21
-
-
Save IanVaughan/0ed86cacfd527ea5d7d27b129b4e6c3c to your computer and use it in GitHub Desktop.
Steps to Upgrade a Heroku DB in a script
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
#!/usr/bin/env bash | |
# https://devcenter.heroku.com/articles/updating-heroku-postgres-databases#updating-with-follower-changeover | |
APP=name-production # name-staging | |
heroku addons:create heroku-postgresql:standard-2 --follow DATABASE_URL --app $APP # DONE | |
heroku addons:wait # DONE | |
for (( ; ; )); do; heroku pg:info --app $APP | grep Behind; sleep 1; done # DONE | |
heroku maintenance:on --app $APP | |
heroku ps:scale worker=0 --app $APP | |
heroku pg:info --app $APP | |
heroku pg:unfollow DATABASE_URL --app $APP | |
heroku pg:promote HEROKU_POSTGRESQL_TEAL_URL --app $APP | |
heroku ps:scale worker=1 --app $APP | |
heroku maintenance:off --app $APP | |
heroku addons:destroy HEROKU_POSTGRESQL_ORANGE_URL | |
heroku addons:destroy HEROKU_POSTGRESQL_SILVER_URL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment