Easily change the dates and times on your photos and videos
Click here for more info about the app
English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app

How to Import/Export a Database from One Heroku App to Another Heroku App


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.

See Heroku's docs for more information

Tagged w/ #heroku #database #postgres #commands #pg #production #staging #devops