Created
June 12, 2012 09:30
-
-
Save tommi-lew/2916467 to your computer and use it in GitHub Desktop.
Commands for managing heroku & postgres
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
#list current backups | |
heroku pgbackups --app app_name | |
#do a manual backup immediately | |
heroku pgbackups:capture --expire --app app_name | |
#restore postgres with dump (overwrite current state) | |
pg_restore --clean --no-acl --no-owner -d database_name dump_filename | |
#download dump and save as file | |
curl -O url_to_dump | |
#get url of latest pg backup | |
heroku pgbackups:url --app app_name |
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
#create a db | |
createdb db_name | |
#list dbs | |
psql -l |
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
#create a db | |
createdb db_name | |
#list dbs | |
psql -l |
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
ref: https://devcenter.heroku.com/articles/upgrading-postgres-versions | |
#Install plugin to upgrade database | |
heroku plugins:install git://github.com/hgimenez/heroku-pgupgrade.git | |
#Create a follower for current database | |
heroku addons:add heroku-postgresql:zilla --follow HEROKU_POSTGRESQL_<current-color> --app <current appname> | |
#Wait until following is done. | |
heroku pg:wait | |
#Upgade database to 9.1 | |
heroku pg:upgrade HEROKU_POSTGRESQL_<new-color> | |
#Change database to new one | |
heroku pg:promote HEROKU_POSTGRESQL_<new-color> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment