-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: crdb enum cast error when executing the prepared stmt twice (#4448)
- Loading branch information
Showing
3 changed files
with
64 additions
and
19 deletions.
There are no files selected for viewing
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
50 changes: 50 additions & 0 deletions
50
query-engine/connector-test-kit-rs/query-engine-tests/tests/new/regressions/prisma_21901.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,50 @@ | ||
use indoc::indoc; | ||
use query_engine_tests::*; | ||
|
||
#[test_suite(schema(schema), capabilities(Enums, ScalarLists), exclude(MongoDb))] | ||
mod prisma_21901 { | ||
fn schema() -> String { | ||
let schema = indoc! { | ||
r#"model Test { | ||
#id(id, Int, @id) | ||
colors Color[] | ||
} | ||
enum Color { | ||
red | ||
blue | ||
green | ||
} | ||
"# | ||
}; | ||
|
||
schema.to_owned() | ||
} | ||
|
||
// fixes https://github.com/prisma/prisma/issues/21901 | ||
#[connector_test] | ||
async fn test(runner: Runner) -> TestResult<()> { | ||
insta::assert_snapshot!( | ||
run_query!( | ||
runner, | ||
r#"mutation { createOneTest(data: { id: 1, colors: ["red"] }) { colors } }"# | ||
), | ||
@r###"{"data":{"createOneTest":{"colors":["red"]}}}"### | ||
); | ||
|
||
insta::assert_snapshot!( | ||
run_query!(runner, fmt_execute_raw(r#"TRUNCATE TABLE "prisma_21901_test"."Test" CASCADE;"#, [])), | ||
@r###"{"data":{"executeRaw":0}}"### | ||
); | ||
|
||
insta::assert_snapshot!( | ||
run_query!( | ||
runner, | ||
r#"mutation { createOneTest(data: { id: 2, colors: ["blue"] }) { colors } }"# | ||
), | ||
@r###"{"data":{"createOneTest":{"colors":["blue"]}}}"### | ||
); | ||
|
||
Ok(()) | ||
} | ||
} |