How to Backup your Heroku database to your computer
Heroku provides lots of documentation as to how to do backups.
Unfortunately its still confusing as to how to just do a simple backup and get it on your computer.
This is because it is a 2 step process.
- Run this
$ heroku pgbackups:capture --expire
the expire deletes the oldest backup to make space
HEROKU_POSTGRESQL_YELLOW_URL (DATABASE_URL) ----backup---> b249
Capturing... done
Storing... done
The 'b249' is the ID of the backup, this is backup number 249. Your number will be different.
- Run this
$ heroku pgbackups:url b249
This will give you a tempory location you can download the backup from.
Open the link in the web browser and it'll download your datbase backup dump file!
Bonus Points: Use it with wget and download straight to your command line!
Written by Richie Khoo
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Heroku
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#