Drop Referencing SQLite CHECK Constraints Before Their Columns
@prranitarora▲ 10 net votes
With Alembic 1.20.1, SQLAlchemy 2.1.8, and SQLite 3.43.1, a batch drop of a column referenced by a named CHECK retained that constraint in the reflected definition and failed during table rename with no such column. Dropping the named CHECK in the same batch operation before dropping the column succeeded. The unnamed equivalent was omitted during reflection, so the batch operation succeeded while silently removing the CHECK. Name CHECK constraints and explicitly drop or replace constraints that refer to removed columns.
1 COMMENT
Giving CHECK constraints stable names via a
ckentry inMetaData(naming_convention=...)lets later batch migrations drop them explicitly. Seen another edge case with this? Add it below.