postgresql - How to change database_url on heroku? -


i trying share database between 2 apps on heroku according share database between 2 apps in heroku setting database_url on second app gives error:

$ heroku config:add database_url=postgres://... setting config vars , restarting pacific-headland-1960... failed    !    cannot destroy last attachment billing app resource loving-subtly-5807 

database_url what's storing second app's connection provisioned db, heroku kindly preventing deleting because there no other references it.

first, remove second application's db. anything in destroyed.

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

if these new apps, db tier hobby-dev, can check running heroku addons --app <your second app>.

then, you'll able set database_url on second app.

if want have second app connected both dbs, you'll need store first app's db url in different environment variable , update second app's code use it.


unrelated question, you've pasted db credentials public space. should roll them heroku pg:credentials --reset --app <your first application>.

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


Comments