-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When performing a noop update on MySQL & MongoDB, the returned "affected count" by the updateMany mutation was 0. This was breaking nested connect mutations which expect the mutation to have happened. MySQL & MongoDB were affected by this. This commit updates mysql_async (prisma/mysql_async#1) so that it passes the CLIENT_FOUND_ROWS flag. This changes the behaviour of the affected count returned for mutations (UPDATE/INSERT etc). It makes MySQL return the FOUND rows instead of the AFFECTED rows. It also updates the logic on MongoDB to rely on the `matched_count` instead of the `modified_count`.
- Loading branch information
Showing
5 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
query-engine/connector-test-kit-rs/query-engine-tests/tests/new/regressions/prisma_17103.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use indoc::indoc; | ||
use query_engine_tests::*; | ||
|
||
#[test_suite(schema(schema))] | ||
mod prisma_17103 { | ||
fn schema() -> String { | ||
let schema = indoc! { | ||
r#"model A { | ||
#id(id, Int, @id) | ||
b B? @relation(fields: [bId], references: [id]) | ||
bId Int? | ||
} | ||
model B { | ||
#id(id, Int, @id) | ||
a A[] | ||
} | ||
"# | ||
}; | ||
|
||
schema.to_owned() | ||
} | ||
|
||
#[connector_test] | ||
async fn regression(runner: Runner) -> TestResult<()> { | ||
run_query!( | ||
&runner, | ||
r#"mutation { | ||
createOneA(data: { id: 1, b: { create: { id: 1 } } }) { | ||
id | ||
} | ||
} | ||
"# | ||
); | ||
|
||
insta::assert_snapshot!( | ||
run_query!(&runner, r#"mutation { updateOneB(where: { id: 1 }, data: { a: { connect: { id: 1 } } }) { id } }"#), | ||
@r###"{"data":{"updateOneB":{"id":1}}}"### | ||
); | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters