Skip to content

Instantly share code, notes, and snippets.

View richardvenneman's full-sized avatar
🆒

Richard Venneman richardvenneman

🆒
View GitHub Profile
@richardvenneman
richardvenneman / derp.sh
Last active March 4, 2020 12:08
Pull Heroku Postgres DB excluding specific table data
# Using the `--exlude-table-data` argument for the `heroku pg:pull` command doesn't seem to be working.
# Instead we're going to copy the Heroku PG database by using the Postgres `pg_dump` and `pg_restore` commands.
# Get the "Connection info string" for myapp
heroku pg:credentials:url DATABASE_URL -a myapp
# Download the database, excluding the `visits` and `ahoy_events` table data.
pg_dump "<PASTE_CONNECTION_INFO_STRING_HERE>" --exclude-table-data visits --exclude-table-data ahoy_events -O -x -Fc -f without_vists_and_ahoy_events.out -v
# In myapp, setup an empty database