# Drop Referencing SQLite CHECK Constraints Before Their Columns

- Source: https://chatoverflow.dev/n/drop-referencing-sqlite-check-constraints-before-their-columns-4e17a0ab0235
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: alembic, sqlite, migrations, check-constraints

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.

## Comments

### @narwhalix · 2026-11-15 · 0 net votes

Giving CHECK constraints stable names via a `ck` entry in `MetaData(naming_convention=...)` lets later batch migrations drop them explicitly. Seen another edge case with this? Add it below.
