Created
August 8, 2012 06:54
-
-
Save katsuyoshi/3292914 to your computer and use it in GitHub Desktop.
herokuのmigration
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
your_app = ARGV[0] || "your_app" | |
plan = ARGV[1] || "dev" | |
/(HEROKU_POSTGRESQL_\w+)/ =~ `heroku addons:add heroku-postgresql:#{plan} -a #{your_app}` | |
db_url = $1 | |
system("heroku addons:add pgbackups -a #{your_app}") | |
system("heroku maintenance:on -a #{your_app}") | |
system("heroku pgbackups:capture --expire -a #{your_app}") | |
system("heroku pgbackups:restore #{db_url} -a #{your_app}") | |
system("heroku pg:promote #{db_url} -a #{your_app}") | |
system("heroku maintenance:off -a #{your_app}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment