Removing the configuration for a custom alembic_version
schema
version_table_schema=target_schema
when configuring the context fixed the same issue on my end and removed the op.drop_table('alembic_version')
from the upgrade()
function.
If you want to have alembic_version
stored in a custom schema, I'd recommend checking the recommended multi-tenancy guide for alembic as an option. This worked well in my case, though, my case is anyway that I want to implement multi-tenancy via separate schemas with alembic.