E.g. having model as
class Message(BaseModel):
recipient: Mapped[str] = mapped_column("recipient", CheckConstraint("column_one IS NULL or column_other IS NULL", name="recipient"))
('remove_constraint', CheckConstraint(<sqlalchemy.sql.elements.TextClause object at 0x7f7874eeee50>, name='message', table=Table('message', MetaData(), Column('x', Integer(), table=<message>), schema=None)))
Discussed in #1841
Originally posted by ziima August 5, 2026
With alembic 1.19.0 I discovered a number of
remove_constraintoperations detected in alembic check output. I looked around a bit and I discovered all are caused by theCheckConstraints defined as part of a column.E.g. having model as
alembic checkgeneratesThe part
Column('x', Integer()is a literal output, despite all my constraints areTEXTorUUIDfields and none of the field is namedx.alembic checkworks fine, if I move theCheckConstraintto__table_args__with no other changes.Do I define the
CheckConstraintincorrectly and am I required to define them only at__table_args__or is that a bug in autogeneration?