Skip to content

Instantly share code, notes, and snippets.

@christiannelson
Created March 29, 2018 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiannelson/a1a1fcd4f3f51d53c1867329b90dd522 to your computer and use it in GitHub Desktop.
Save christiannelson/a1a1fcd4f3f51d53c1867329b90dd522 to your computer and use it in GitHub Desktop.
Upgrading a Heroku DB
# The steps for upgrading a Heorku PostgreSQL database.
#
# https://devcenter.heroku.com/articles/upgrading-heroku-postgres-databases
# https://elements.heroku.com/addons/heroku-postgresql
heroku addons:create heroku-postgresql:hobby-basic -r production
heroku pg:info -r production
# Note the database names, we'll call them HEROKU_POSTGRESQL_NEW_URL and HEROKU_POSTGRESQL_OLD_URL
heroku maintenance:on -r production
heroku pg:copy HEROKU_POSTGRESQL_OLD_URL HEROKU_POSTGRESQL_NEW_URL -r production
heroku pg:info -r production
# Sanity check, do the DBs have roughly the same number of rows?
heroku pg:promote HEROKU_POSTGRESQL_NEW_URL -r production
heroku ps:restart -r production
heroku maintenance:off -r production
# Sanity check: is the app working as expected?
heroku addons:destroy HEROKU_POSTGRESQL_OLD_URL -r production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment