Copy Heroku Database To Local
I’ve had a few Heroku projects where it’s been really nice to copy production data to my local database for development. Obviously, there are a few security concerns with this method (make sure the data in your project should be on your local machine – don’t do this if you’ve got any sensitive data!).
If you’re ok with having that data locally, you can add this script at
With that in place, you can run the task with
This will grab your latest Postgres backup and save it locally to
tmp/latest.dump. It then grabs your local DB credentials and performs a
pg_restore to restore the dump file to your local database.