Created
November 22, 2013 16:27
-
-
Save mattbeedle/7602678 to your computer and use it in GitHub Desktop.
A simple bash script to replicate your heroku database onto your development database. Stick it in to your scripts folder in a rails app and chmod+x it. Then you can run ./script/replicate and debug any production issues with the production data.
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
#!/usr/bin/env bash | |
echo "Running: heroku pgbackups:capture --remote production" | |
heroku pgbackups:capture --remote production | |
echo "curl'ing the latest.dump" | |
curl -o latest.dump `heroku pgbackups:url --remote production` | |
echo "restoring the dump" | |
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U postgres -d project_name_development latest.dump | |
echo "removing latest.dump" | |
rm latest.dump |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment