forked from prisma/prisma-engines
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(quaint): extract constraint name from CockroachDB foreign key con…
…straint violation error (prisma#5002) * fix(quaint): extract constraint name from cockroachdb foreign key constraint violation error * chore: normalise "regex" version across multiple crates * chore: adjust test assertions for "ForeignKeyViolation" * chore: adjust test assertions for "ForeignKeyViolation" * test(quaint): add explicit regression test for issue prisma/prisma#24072, via new macro "assert_connector_error" * fix(ci): add fix for SQL Server 2017 * fix(ci): fix schema-engine for SQL Server 2017 * chore: get rid of leftover comments * test(quaint): fix tests for MySQL 5.6, 5.7, and MongoDB * chore: get rid of CI: True * Revert "fix(ci): fix schema-engine for SQL Server 2017" This reverts commit 5aebbbf. * Revert "fix(ci): add fix for SQL Server 2017" This reverts commit f7cdacd. * test(quaint): fix for PlanetScale * test(quaint): fix tests for PlanetScale
- Loading branch information
Showing
19 changed files
with
110 additions
and
30 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
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
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
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
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
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
54 changes: 54 additions & 0 deletions
54
query-engine/connector-test-kit-rs/query-engine-tests/tests/new/regressions/prisma_24072.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,54 @@ | ||
use indoc::indoc; | ||
use query_engine_tests::*; | ||
|
||
// Skip databases that don't support `onDelete: SetDefault` | ||
#[test_suite( | ||
schema(schema), | ||
exclude( | ||
MongoDb, | ||
MySql(5.6), | ||
MySql(5.7), | ||
Vitess("planetscale.js"), | ||
Vitess("planetscale.js.wasm") | ||
) | ||
)] | ||
mod prisma_24072 { | ||
fn schema() -> String { | ||
let schema = indoc! { | ||
r#"model Parent { | ||
#id(id, Int, @id) | ||
child Child? | ||
} | ||
model Child { | ||
#id(id, Int, @id) | ||
parent_id Int? @default(2) @unique | ||
parent Parent? @relation(fields: [parent_id], references: [id], onDelete: NoAction) | ||
}"# | ||
}; | ||
|
||
schema.to_owned() | ||
} | ||
|
||
// Deleting the parent without cascading to the child should fail with an explicitly named constraint violation, | ||
// without any "(not available)" names. | ||
#[connector_test] | ||
async fn test_24072(runner: Runner) -> TestResult<()> { | ||
insta::assert_snapshot!( | ||
run_query!(&runner, r#"mutation { createOneParent(data: { id: 1, child: { create: { id: 1 }}}) { id }}"#), | ||
@r###"{"data":{"createOneParent":{"id":1}}}"### | ||
); | ||
|
||
assert_connector_error!( | ||
&runner, | ||
"mutation { deleteOneParent(where: { id: 1 }) { id }}", | ||
2003, | ||
CockroachDb(_) | Postgres(_) | SqlServer(_) | Vitess(_) => "Foreign key constraint violated: `Child_parent_id_fkey (index)`", | ||
MySql(_) => "Foreign key constraint violated: `parent_id`", | ||
Sqlite(_) => "Foreign key constraint violated: `foreign key`", | ||
_ => "Foreign key constraint violated" | ||
); | ||
|
||
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
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
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