I’m having trouble with my Postgres clusters. My latest deploy could not resolve the internal Postgres hostname hrmfitclub-stage-db.internal so I detached and attempted to re-attach my postgres cluster - now the reattach doesn’t work
fitclub_server master % flyctl postgres attach -v -a hrmfitclub-stage --postgres-app hrmfitclub-stage-db
WARN app flag 'hrmfitclub-stage' does not match app name in config file 'hrmfitclub-prod'
? Continue using 'hrmfitclub-stage' Yes
Oops, something went wrong! Could you try that again?
Do you have the admin credentials stored still? This happens because it fails to create a new database for your app since a DB with the same name already exists. If you connect and drop the old DB you can re-attach with the same name.
Alternatively, you can pass --database-name to the attach command to override it.
I did try to add the --database-name - still doesn’t work:
fitclub_server master % flyctl postgres attach -v -a hrmfitclub-stage --postgres-app hrmfitclub-stage-db --database-name hrmfitclub_stage
WARN app flag 'hrmfitclub-stage' does not match app name in config file 'hrmfitclub-prod'
? Continue using 'hrmfitclub-stage' Yes
Oops, something went wrong! Could you try that again?