Created
August 2, 2012 14:56
-
-
Save JustinLove/3237640 to your computer and use it in GitHub Desktop.
Migrate from Heroku shared database to new database plans (dev currently embedded)
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
# ruby migrate.rb <app-name> | |
app = ARGV[0] | |
require 'heroku' | |
hc = Heroku::Client.new(ENV['HEROKU_USER'], ENV['HEROKU_PASS']) | |
response = hc.install_addon(app, 'heroku-postgresql:dev') | |
puts response | |
db = response['message'][/HEROKU_POSTGRESQL_\w+/] | |
puts hc.install_addon(app, 'pgbackups') | |
hc.maintenance(app, :on) | |
system("heroku pgbackups:capture --expire --app #{app}") | |
system("heroku pgbackups:restore #{db} --confirm #{app} --app #{app}") | |
system("heroku pg:promote #{db} --app #{app}") | |
hc.maintenance(app, :off) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment