Repository navigation
Description
2026-11-11: the guard is tracked in SchemaKit now, as CaffeinatedCoder/CodoMetis.EFCore.SchemaKit#47 in its
11.0.0milestone. It ships there first (ROADMAP D1); 5.x takes fixes only, so the 5.x half of this design, the 5.6.0 placement and the transfer are not built. The findings below were carried into that issue. The design document stays readable on the branch of #65.
Goal
Design the delete guard (ROADMAP.md D1, section 4.2) so that it can ship on EFCore.ComplexIndexes 5.x, if an EF Core 10 application needs it, and move to CodoMetis.EFCore.SchemaKit (#37, CaffeinatedCoder/CodoMetis.EFCore.SchemaKit#11) without a migration (#59), extensible there to update guards, append-only tables, immutable columns and guards on SQL Server and SQLite.
The consumer case: an application had to hand-write CREATE TRIGGER in a migration to stop rows in a final state from being deleted. Nothing in the model records it, nothing diffs it, and EnsureCreated() never creates it.
Deliverable
design/delete-guard.md in a draft PR. No implementation.
Findings so far (verified on PostgreSQL 14 and 18)
ROADMAP 4.2 needs these corrections before it is built:
ALTER TRIGGER … RENAMEkeeps the trigger's arguments, so a name passed asTG_ARGV[0]goes stale and the application's error mapping stops matching. UseTG_NAME.CREATE OR REPLACE FUNCTIONfails with 42501 under a second migration role, and would let a later package version change every existing guard. Create if missing; freeze the body.ALTER COLUMN … TYPEon a column in a trigger'sWHENfails at apply time. Guards reading an altered column need a forced rebuild.- The typed-filter translation lets a row with a null column through a guard whose C# predicate covers it (
Status != "Draft"). Guards need C# null semantics. - Trigger names over 63 bytes are truncated with only a NOTICE; a guard may share its name with a CHECK constraint.
Recommendation (in the doc)
Build it in a 5.6.0, not in 5.5.0; 4.1 is not a prerequisite on 5.x. The 5.x "fixes only" rule needs one narrow exception, worded in section 10. A 5.6.0 epic is proposed, not created: milestone left empty until the maintainer decides.
Activity
docs: the delete guard inherits C# null semantics from #68 (#64)
docs: correct the NU1608 claim in ROADMAP.md, and align the delete gu…
docs: align the delete guard's SchemaKit side with #61 (#64)
CaffeinatedCoder commentedon Nov 11, 2026
Not built on 5.x. Tracked in SchemaKit as CaffeinatedCoder/CodoMetis.EFCore.SchemaKit#47.