Created
July 5, 2021 19:45
-
-
Save cjavdev/89db51298d02d62b71c4abd3ed6f04aa to your computer and use it in GitHub Desktop.
Quick and dirty clone heroku postgres db locally
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 | |
set -e | |
# Dump prod database into ./heroku.dump | |
curl `heroku pg:backups public-url` > heroku.dump | |
# Drop and recreate the local database | |
rails db:drop db:create | |
# Reload the data from ./heroku.dump into postgres | |
pg_restore --verbose --clean --no-acl --no-owner -h localhost -d YOUR_DB_NAME ./heroku.dump |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment