Created
November 17, 2014 19:39
-
-
Save jontonsoup/bc4cb003c6b3402592aa to your computer and use it in GitHub Desktop.
backup script
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
namespace :mirror do | |
desc "Mirror production database" | |
task :production do | |
app = "skilledup-academy-staging" | |
production_database = "skilledup-academy-production::DATABASE_URL" | |
heroku_command("pg:reset DATABASE_URL", app) | |
transfer_database("#{production_database} DATABASE_URL", app) | |
heroku_command("run rake db:migrate", app) | |
end | |
def transfer_database(command, app) | |
heroku_command("pgbackups:transfer #{command}", app) | |
end | |
def heroku_command(command, app) | |
`heroku #{command} -a #{app} --confirm #{app}` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment