Heroku: How to sync your production database with your development environment.

Apart from heroku db:pull (uses taps and imports from psql to any local sql database) there is a faster way to download and import the production data to your local server.

1. Generate a dump file of the production database using

heroku pgbackups:capture

This will actually run the pg_dump script on the production server
2. List the backups

heroku pagbackups

3. Get the download-able url of the latest backup listed

heroku pgbackups {lates_backup_name}:url

4. Download the file using the returned url.

Postgresql can use the files comming from the pg_dump with the usage of pg_restore.

Now try this

pg_restore --verbose --clean --no-acl --no-owner -h -U savvasmsc -d sweetlifer_development ~/Downloads/b019.dump