Created
October 21, 2014 15:49
-
-
Save scottweisman/53f3d38c68f6e5f58d90 to your computer and use it in GitHub Desktop.
heroku tasks
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 :heroku do | |
desc 'Pull most recent DB from Heroku and dump into local' | |
task :db_pull => :environment do | |
heroku_app = "my-app-name" | |
local_db = "local-db_dev" | |
system "heroku pgbackups:capture --expire --app #{heroku_app}" | |
system "curl -o latest.dump `heroku pgbackups:url --app #{heroku_app}`" | |
system "pg_restore --verbose --clean --no-acl --no-owner -h localhost -d #{local_db} latest.dump" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment