Support ON UPDATE CASCADE via CascadeOnUpdate attribute#175
Conversation
msallin
commented
Jun 16, 2026
Entity Framework has no concept of update-cascade (it assumes immutable keys), so the generated DDL only ever emitted ON DELETE CASCADE. Neither ForeignKeyAttribute nor the fluent API can express ON UPDATE CASCADE. Add an opt-in CascadeOnUpdateAttribute placed on the dependent foreign key property. It is registered as a column annotation, survives the EF model build, and is read back from the store model during SQL generation to append the ON UPDATE CASCADE clause to the foreign key constraint. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughAdds ChangesCascadeOnUpdate Support
Sequence DiagramsequenceDiagram
participant App as Application
participant Initializer as SqliteInitializerBase
participant AssocType as SqliteAssociationType
participant Builder as ForeignKeyStatementBuilder
participant Statement as ForeignKeyStatement
rect rgba(100, 149, 237, 0.5)
App->>Initializer: InitializeDatabase(context)
Initializer->>Initializer: RegisterAttributeAsColumnAnnotation[CascadeOnUpdateAttribute]
Initializer->>AssocType: new SqliteAssociationType(storeAssociation)
AssocType->>AssocType: scan ToProperties for CascadeOnUpdateAttribute annotation
AssocType-->>Builder: CascadeUpdate = true
Builder->>Statement: new ForeignKeyStatement { CascadeDelete, CascadeUpdate }
Statement-->>Builder: CreateStatement() → "FOREIGN KEY ... ON DELETE CASCADE ON UPDATE CASCADE"
Builder-->>Initializer: DDL SQL
Initializer-->>App: database initialized
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|


