Skip to content

Instantly share code, notes, and snippets.

@scottweisman
Created October 21, 2014 15:49
Show Gist options
  • Save scottweisman/53f3d38c68f6e5f58d90 to your computer and use it in GitHub Desktop.
Save scottweisman/53f3d38c68f6e5f58d90 to your computer and use it in GitHub Desktop.
heroku tasks
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