Created
January 16, 2017 15:25
-
-
Save pirj/48e7e48df0f674a7e801489906dbe873 to your computer and use it in GitHub Desktop.
Pull Heroku DB from staging/prod to local dev
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
psql -c "select pg_terminate_backend(pid) from pg_stat_activity where datname='LOCAL_DB_NAME'" postgres $(whoami) \ | |
&& psql -c 'drop database LOCAL_DB_NAME' postgres $(whoami) \ | |
&& heroku pg:pull DATABASE_URL LOCAL_DB_NAME --app APP_NAME | |
# Replace LOCAL_DB_NAME to say myblog_development and APP_NAME to myblog_staging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment