How to change database_url on heroku?

前端 未结 2 1087
陌清茗
陌清茗 2020-12-06 16:34

I am trying to share a database between two apps on Heroku according to Share database between 2 apps in Heroku but setting up database_url on the second app gi

相关标签:
2条回答
  • 2020-12-06 17:00

    DATABASE_URL is what's currently storing your second app's connection to its provisioned DB, which Heroku is kindly preventing you from deleting because there are no other references to it.

    First, remove the second application's DB. Anything in it will be destroyed.

    heroku addons:destroy heroku-postgresql:<your DB tier> --app <your second app>
    

    If these are new apps, your DB tier is probably hobby-dev, but you can check for it by running heroku addons --app <your second app>.

    Then, you'll be able to set DATABASE_URL on the second app.

    If you want to have the second app connected to both DBs, you'll need to store the first app's DB URL in a different environment variable and update your second app's code to use it.


    Unrelated to your question, you've just pasted your DB credentials into a public space. You should roll them with heroku pg:credentials --reset --app <your first application>.

    Docs: https://devcenter.heroku.com/articles/heroku-postgresql

    0 讨论(0)
  • 2020-12-06 17:12

    From Heroku

    Previously to add an add-on you could use the command addons:add. That command is now deprecated in favor of the create command.

    0 讨论(0)
提交回复
热议问题