For some reason, after adding a new column to a model, alembic's command alembic revision --autogenerate
detects a new table and, accordingly, generates a new migration for the whole entity, instead of picking up new columns only.
A model's base class is mentioned in env.py configuration file as target_metadata = MyBase.metadata
, so it's picking up new models. However, when you add a new column, instead of generating a revision with a new column added only, it regenerates the entire model.
Before running alembic revision --autogenerate
, new changes are migrated to db with alembic upgrade head
.
I have a standard declarative_base for my base class and my models extend it.
Is there something else that could go wrong? Probably I am missing out on something obvious ;(