I'm automating the migration of some tenant databases. I have one set of credentials and I'm replacing the database name into the connection string. However, alembic is creating tables in the postgres/public database/schema, presumably as that's the default database for the credentials I have.
My connection string looks like
CS=postgresql://username:[email protected]/some_tenant
my alembic command looks like
alembic -x sqlalchemy.url='$CS' upgrade xxyyzz123
Is it possible to get alembic to honour the database specified in the connection string?
Ideally I don't want to include an environment in the alembic.ini for each tenant. The script I'm writing lists all tenant databases on the server (by a name prefix) and calls alembic with that database name appended to the connection string.