fix: invalidate empty-table proof after writes and table renames

This commit is contained in:
ftrinidad committed 2026-10-28 18:43:04 -03:00
1 parent c7a4376d35
commit 66f39b1c48
7 files changed
+285 -29

No files matched your search

+6 -3
View File
@@ -4,9 +4,12 @@
**Decision.** The `NOT_NULL` SQL check accepts `ALTER TABLE ... ADD COLUMN ... NOT NULL`
only when the same migration unconditionally created that exact table. `CREATE TABLE IF
NOT EXISTS` does not prove an empty table. The migration remains
fully linted, so `RunSQL`, `RunPython`, and operations on existing tables retain their
checks.
NOT EXISTS`, SQL inserts, and data operations, including nested
`SeparateDatabaseAndState` operations, do not prove an empty table. The migration remains fully
linted, so top-level and nested `RunSQL` and `RunPython`, and operations on existing tables retain
their checks. Custom database operations are not trusted as declarative schema operations and
therefore invalidate the proof. Table renames also invalidate it because a name can be reused by a
populated table.
**Rejected.** Ignoring all initial migrations or naming them as exemptions. Either option
skips unsafe operations that the linter must inspect.