Created
December 19, 2020 15:08
-
-
Save searls/6c57146431c791d141ae64e2358aeccf to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
# This blog post has helped a lot of folks figure out how to pull down their production database | |
# from Heroku without bringing their application to a screeching halt. | |
# https://blog.testdouble.com/posts/2019-11-12-downloading-large-heroku-postgres-backups/ | |
# | |
# Here's a silly little script that will do it all for you. (YMMV, don't actually use this, etc) | |
require "date" | |
out = `heroku addons:create heroku-postgresql:standard-0 --fast --fork DATABASE_URL` | |
addon = out.match(/(\S+) is being created in the background/)[1] | |
`heroku pg:wait` | |
`heroku pg:pull #{addon} kamesame_production-#{Date.today}` | |
`heroku addons:remove #{addon} --confirm kamesame-production` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment