Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Steps to Upgrade a Heroku DB in a script
#!/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