Created
March 29, 2018 16:09
-
-
Save christiannelson/a1a1fcd4f3f51d53c1867329b90dd522 to your computer and use it in GitHub Desktop.
Upgrading a Heroku DB
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
# 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