Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
fixes prisma/prisma#17103
When performing a noop update on MySQL & MongoDB, the returned count of "affected rows" by the
updateMany
mutation was 0. This was breaking nested connect mutations which ensures the mutation has happened by relying on this count.prisma-engines/query-engine/core/src/query_graph_builder/write/nested/connect_nested.rs
Lines 234 to 240 in a99c688
This PR does the following:
CLIENT_FOUND_ROWS
flag. This changes the behavior of the affected count returned for mutations (UPDATE/INSERT etc). It makes MySQL return the FOUND rows instead of the AFFECTED rows.updateMany
connector logic on MongoDB to rely on thematched_count
instead of themodified_count
Note that relying on the "matched count" (found rows) instead of the "modified count" (affected rows) does not break OCC because it still would return 0 if the filter doesn't match any row (because the "discriminant" field (eg:
version
field) got updated by another update).It does change what
updateMany
anddeleteMany
now returns for MySQL. We believe the only "meaningful" count that can be used in an application to do any kind of logic is 0 though. Since 0 will still be returned in useful cases, we don't believe this is a breaking change.