Skip to content

Instantly share code, notes, and snippets.

@sbleon
Created June 6, 2012 16:54
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 sbleon/2883249 to your computer and use it in GitHub Desktop.
Save sbleon/2883249 to your computer and use it in GitHub Desktop.
Upgrade a Heroku shared database to the PostgreSQL 9.1 dev plan

Heroku's Postgres Dev Plan lets you use PostgreSQL 9.1 instead of 8.x, which is what their shared-base offering uses.

Please note that the dev plan is in BETA, and is not recommended for use in production systems.

Also, automatic database backups are not available on the dev plan, so make sure you're backing your data up yourself!

heroku maintenance:on
heroku pgbackups:capture
# Note BACKUP LABEL here. You'll need it shortly.
# It might be something like b072.
curl -o final_shared_database_backup.dmp `heroku pgbackups:url`
heroku addons:add heroku-postgresql:dev
# Note COLOR here. You'll need it shortly
heroku pgbackups:restore HEROKU_POSTGRESQL_<COLOR> <BACKUP LABEL>
heroku pg:promote HEROKU_POSTGRESQL_<COLOR>
# This step will destroy your shared database. Make sure you trust your backups!
# I've commented it out as a safety precaution.
# heroku addons:remove shared-database:5mb # (or whatever size your shared database is.)
heroku maintenance:off
heroku restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment