Skip to content

Commit

Permalink
psl: add negative test when using the new relation mode 'prismaSkipIn…
Browse files Browse the repository at this point in the history
…tegrity' with non-MongoDB connectors.
  • Loading branch information
ItzSiL3Nce committed Aug 7, 2023
1 parent 71be3ed commit 2fa2a53
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions psl/psl/tests/attributes/relations/relations_negative.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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\"."
));
}

0 comments on commit 2fa2a53

Please sign in to comment.