Heroku is awesome! Let's say we want to copy a production database to a staging database.
We can use the pg:backups:restore
command to accomplish this. Here is an example. For the source database we are using the production-app-name
and for staging we are using staging-app-name
. Replace these with the names of your apps.
heroku pg:backups:restore production-app-name::b001 DATABASE_URL --app staging-app-name
Where b001
is the database capture you want to restore. To make a capture run
heroku pg:backups:capture -a production-app-name
Heroku will make you retype the name of the app you want to import into because it is a destructive action.
Short and sweet.
Just finishing up brewing up some fresh ground comments...