I am using Alembic to manage migrations for a database. The same database is used by multiple Python packages and each of them have their own migration paths.
How I can tell Alembic to ignore tables from other packages when generating automatic migrations? For example when I run:
alembic -c development.ini revision --autogenerate -m "Initial migration"
My migration Python file contains drop tables for other packages (not in the current Alembic env.py):
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table('table_from_another_package`)
I can manually edit migration file and remove drop_table()
and create_table()
entries, but this is manual error prone work. I'd rather avoid generating them in the first place.