Skip to content

Instantly share code, notes, and snippets.

@pirj
Created January 16, 2017 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pirj/48e7e48df0f674a7e801489906dbe873 to your computer and use it in GitHub Desktop.
Save pirj/48e7e48df0f674a7e801489906dbe873 to your computer and use it in GitHub Desktop.
Pull Heroku DB from staging/prod to local dev
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