-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add EntityEdgeDeletionBehavior.SET_NULL_INVALIDATE_CACHE_ONLY #178
Conversation
910e244
to
22f9f4a
Compare
Codecov Report
@@ Coverage Diff @@
## main #178 +/- ##
==========================================
+ Coverage 96.17% 96.23% +0.06%
==========================================
Files 80 80
Lines 1985 1991 +6
Branches 257 263 +6
==========================================
+ Hits 1909 1916 +7
+ Misses 71 70 -1
Partials 5 5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
22f9f4a
to
25cf6bb
Compare
mutatorFactory | ||
.forUpdate(inboundReferenceEntity, queryContext) | ||
.setField(fieldName, null) | ||
['updateInTransactionAsync']( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does type checking still work with the indexed accessor? Might be better to cast the type of setField's return value to an UpdateMutator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, typechecking still works.
Why
Previously it was recommended to use
EntityEdgeDeletionBehavior.CASCADE_DELETE_INVALIDATE_CACHE
when the database was set up to doON DELETE SET NULL
, but this had the bug where the deletion triggers would be run for the entity that was not actually being deleted by the DBMS (it was just being updated).The correct solution before this PR was to use
EntityEdgeDeletionBehavior.SET_NULL
and rely upon entity to do the right thing.This PR introduces a new
EntityEdgeDeletionBehavior
for theON DELETE SET NULL
case,EntityEdgeDeletionBehavior.SET_NULL_INVALIDATE_CACHE_ONLY
, which runs the update triggers (and update cache invalidations) but rely upon the dbms for the actual underlying data update.How
Add new mode and tests.
Notes:
Test Plan
Run tests.