Dumping and Loading Postgres Database
I recently needed to copy staging database from Heroku to my local machine.
- Start Heroku console with bash
pg_dump $DATABASE_URL | bzip2 -c | openssl base64
- Copy printed contents of dump to local machine
cat db/dumps/dump.sql.bz2.base64 | base64 -D | bzcat | sed 's/cobplslmekpzsb/dbuser/g' | psql rails-dev
That's it for this post, thanks for reading!