How to detach Postgres attachment from Heroku app?

28 Views Asked by At

I'm cleaning up some ops stuff on a Rails app hosted on Heroku and noticed we have two postgres attachments set up which means we are paying double. I dug into the tables and saw that one (HEROKU_POSTGRESQL_WHITE) is out of date and apparently not currently being used while another is set up as DATABASE and does have up to date data.

Being the careful person I am, after creating manual backups of both DBs, I went to simply detach the WHITE (unused) DB rather than delete. But Heroku won't let me. The detach button is disabled in the dashboard and via the CLI I'm told Cannot destroy last attachment to billing app for resource. So I tried promoting the other DB and was told postgresql-octagonal-xxxxx is already promoted. Furthermore, this DB does appear to be detachable via the dashboard.

So why is the DB that is being used detachable and the one that isn't not detachable? And how can I fix this?

1

There are 1 best solutions below

0
Martin Bean On

I think the issue is, the database is attached only to that app, so if you detach it, where will it exist? You would have a Postgres resource attached to no apps so therefore would not be able to see it.

Reading this page, it seems that you should just delete the resource rather than trying to detach it from the last app it’s attached to.