Chnaging the DATABASE_URL in heroku

Solution for Chnaging the DATABASE_URL in heroku
is Given Below:

So i tried to deploy my django app to heroku and used the heroku postgres as the database. But the problem was that i have to use postgis and to do that, we need to change the postgres to postgis in the DATABASE_URL. But in heroku we cannot change it as it gives the error;

attachment values cannot be changed.

So i came up with a solution. I removed the heroku-postgres from my main app and create another app, created heroku-postgres there and then took the url of that other app and used that as the value of DATABASE_URL in my main app.

Now i can easily update that as that is not attached with my main app and that worked perfectly.

Now the problem is that, is it necessary to have db attached because heroku says;

Please note that these credentials are not permanent.
Heroku rotates credentials periodically and updates applications where this database is attached.

Credentials mentioned above are the database credentials.

So if the creds change, my app will not work but i cannot attach the db with my main app, as the url will be stored as a new env variable which will be of no use for me.

So, is there any way to either directly change the DATABASE_URL which is attached or is there any way to update even the unattached urls.