Thursday, February 26, 2015

Heroku Postgres Database - Backup and load into development environment

Create a new backup, expire the oldest one at the same time.

$heroku pgbackups:capture --expire

Download the backup to your local file folder

$curl -o latest.dump `heroku pgbackups:url`

Lastly, override your local development db (replacing username and dbname below)

$pg_restore --verbose --clean --no-acl --no-owner -h localhost -U [username] -d [dbname] latest.dump

No comments:

Post a Comment