Heroku transfer db from one app to another

后端 未结 8 1851
攒了一身酷
攒了一身酷 2021-01-31 02:25

I need to transfer db from app_1 to app_2

I created backup on app_1

Then ran:

heroku pg:backups restore HEROKU_POSTGRESQL_COLOR --app app_2 heroku

8条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 03:12

    I found the simpler solution to reuse/share the same resource (postgres database in this case - or any others that allow sharing/reuse) with more than one app on heroku is doing the following:

    1. Go to the older (source) app dashboard on Heroku
    2. Select the "Resources" tab
    3. Locate the resource (postgres database, in our case here)
    4. Click on the icon next to the plan name at the right most part of the row listing the resource
    5. Select the "Attach to another app" option and select the newer (target) app name from the list that shows up

    Sample of the extended menu mentioned @ step #4 above!

    That's all it takes to share the resource between the apps as it automatically updates all the related configuration settings on the target app. This comes handy since none of the add-on related configuration variables are directly editable, at least from the dashboard (have not checked through the CLI). Hope this helps anyone looking for similar thing.

提交回复
热议问题