how can I change the Postgres database that my app is attached to?

So I have an issue in which I’m iterating rapidly on an app, constantly changing the database schema. This creates a big headache when deploying the app because I end up with dozens of schema migration files.

So rather than worrying about migrating my database correctly (I’d rather just wait until I’m ready to actually go into production to start tracking migrations carefully), I’d prefer to just drop whatever the old database was associated with the previous deployment of my app and attach a new database every time I deploy my app to Fly.

Ideally I could have all of this scripted. As I’m working with this at the command line, however, I’m getting a lot of

Error An unknown error occurred.

I think this is because I am perhaps trying to re-use the same name that I had previously used for the Postgres app, or perhaps because my Elixir app can’t be restarted because I went into the Fly dashboard and manually destroyed it’s database.

So I guess my question is: what is the most intelligent way for me to constantly destroy Postgres apps on Fly, unattach them from my app, create new Postgres databases, and then attach them to my app so I can deploy a new version with a fresh database schema?

Thanks.

I have been seeing this error message a lot with attach and detach commands as well.