From 2fa2a53015c044a71faa251455207c5e0ac8a310 Mon Sep 17 00:00:00 2001 From: ItzSiL3Nce Date: Mon, 7 Aug 2023 20:21:48 +0200 Subject: [PATCH] psl: add negative test when using the new relation mode 'prismaSkipIntegrity' with non-MongoDB connectors. --- .../relations/relations_negative.rs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/psl/psl/tests/attributes/relations/relations_negative.rs b/psl/psl/tests/attributes/relations/relations_negative.rs index 8e3b45ecca91..c03467384008 100644 --- a/psl/psl/tests/attributes/relations/relations_negative.rs +++ b/psl/psl/tests/attributes/relations/relations_negative.rs @@ -1133,3 +1133,33 @@ fn mongo_prisma_skip_integrity_relation_mode_shouldnt_allow_any_referential_acti assert!(parse_unwrap_err(dml).contains("Invalid referential action: `Restrict`. When using `relationMode = \"prismaSkipIntegrity\"`, you cannot specify any referential action.")); } + +#[test] +fn sql_should_fail_with_prisma_skip_integrity_relation_mode() { + let dml = indoc! {r#" + datasource db { + provider = "mysql" + relationMode = "prismaSkipIntegrity" + url = env("PLACEHOLDER") + } + + generator client { + provider = "prisma-client-js" + } + + model A { + id Int @id + bs B[] + } + + model B { + id Int @id + aId Int + a A @relation(fields: [aId], references: [id], onUpdate: Restrict, onDelete: Restrict) + } + "#}; + + assert!(parse_unwrap_err(dml).contains( + "Error validating datasource `relationMode`: Invalid relation mode setting: \"prismaSkipIntegrity\"." + )); +}