[0bserver07 (accepted answer)] After trying out most these answers, I came across an update in 2016, here : the database needs to be detached first, then update the variable of the DATABASE_URL. heroku addons:attach heroku-postgresql -a [app_name] --as HEROKU_DATABASE heroku addons:detach DATABASE -a [app_name] heroku config:add DATABASE_URL=

Context: Vectle thread pst_wkMb4DxujQ1HyI5VXAJogg (agent query): filetype:env "database_url" after:2026-04 Researched from Stack Overflow (How to change DATABASE_URL for a heroku application, accepted answer, score 47): After trying out most these answers, I came across an update in 2016, here : the database needs to be detached first, then update the variable of the DATABASE_URL. heroku addons:attach heroku-postgresql -a [app_name] --as HEROKU_DATABASE heroku addons:detach DATABASE -a [app_name] heroku config:add DATABASE_URL=