Part of #339
Parent
#339 — table checks (named multi-column CHECK), auto-migrated
What to build
migrate_updates=True adds a table check or column check that is on the model but missing live: ALTER TABLE … ADD CONSTRAINT on Postgres. Existing rows must pass or connect fails (and that table’s plan rolls back). SQLite warns with the constraint name and skips — no table rebuild.
Alembic autogenerate proposes the same add (no migrate_updates gate — running autogenerate is the request for a diff). Column db_check Field API does not change; toggling it on an existing column now actually adds ck_<table>_<col>.
Acceptance criteria
Blocked by
#341 — declare table checks and emit them on CREATE TABLE
Part of #339
Parent
#339 — table checks (named multi-column CHECK), auto-migrated
What to build
migrate_updates=Trueadds a table check or column check that is on the model but missing live:ALTER TABLE … ADD CONSTRAINTon Postgres. Existing rows must pass or connect fails (and that table’s plan rolls back). SQLite warns with the constraint name and skips — no table rebuild.Alembic autogenerate proposes the same add (no
migrate_updatesgate — running autogenerate is the request for a diff). Columndb_checkField API does not change; toggling it on an existing column now actually addsck_<table>_<col>.Acceptance criteria
migrate_updates=Trueon Postgres emitsADD CONSTRAINT; the CHECK exists inpg_constraint.Field(db_check=True)on an existing closed-domain column addsck_<table>_<col>undermigrate_updateson Postgres.ADD CONSTRAINTwith the same name and body as runtime.migrate_updatesboot with no model change is a no-op (no phantom add).Blocked by
#341 — declare table checks and emit them on CREATE TABLE