-
Use heroku pgbackups to get url of latest backup:
heroku pgbackups:url
-
Download the .dump file.
-
Create a db to restore into:
psql -c "create database firehose_live_backup"
(note: show current dbs with psql
then \list
)
-
Restore into the new db:
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U adamkirk -d firehose_live_backup ~/Downloads/a483.dump
And a bash script to do it all for you:
heroku pgbackups:capture --expire --app firehose-api
url=`heroku pgbackups:url --app firehose-api`
curl $url > ~/Downloads/live_fh_copy.dump
psql -c "drop database firehose_live_backup"
psql -c "create database firehose_live_backup"
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U adamkirk -d firehose_live_backup ~/Downloads/live_fh_copy.dump