Skip to content

Commit 80843b2

Browse files
committed
Add tests for mysql w/ RM = prisma & FK
1 parent 1612c6a commit 80843b2

File tree

7 files changed

+92
-1
lines changed

7 files changed

+92
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"isIncomplete": false,
3+
"items": [
4+
{
5+
"label": "Cascade",
6+
"kind": 13,
7+
"detail": "Delete the child records when the parent record is deleted."
8+
},
9+
{
10+
"label": "Restrict",
11+
"kind": 13,
12+
"detail": "Prevent deleting a parent record as long as it is referenced."
13+
},
14+
{
15+
"label": "NoAction",
16+
"kind": 13,
17+
"detail": "Prevent deleting a parent record as long as it is referenced."
18+
},
19+
{
20+
"label": "SetNull",
21+
"kind": 13,
22+
"detail": "Set the referencing fields to NULL when the referenced record is deleted."
23+
},
24+
{
25+
"label": "SetDefault",
26+
"kind": 13,
27+
"detail": "Set the referencing field's value to the default when the referenced record is deleted."
28+
}
29+
]
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
datasource db {
2+
provider = "mysql"
3+
url = env("DATABASE_URL")
4+
relationMode = "foreignKeys"
5+
}
6+
7+
model Post {
8+
id Int @id @default(autoincrement())
9+
title String
10+
author User @relation(fields: [authorId], references: [id], onDelete: <|>)
11+
authorId Int
12+
}
13+
14+
model User {
15+
id Int @id @default(autoincrement())
16+
posts Post[]
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"isIncomplete": false,
3+
"items": [
4+
{
5+
"label": "Cascade",
6+
"kind": 13,
7+
"detail": "Delete the child records when the parent record is deleted."
8+
},
9+
{
10+
"label": "Restrict",
11+
"kind": 13,
12+
"detail": "Prevent deleting a parent record as long as it is referenced."
13+
},
14+
{
15+
"label": "NoAction",
16+
"kind": 13,
17+
"detail": "Prevent deleting a parent record as long as it is referenced."
18+
},
19+
{
20+
"label": "SetNull",
21+
"kind": 13,
22+
"detail": "Set the referencing fields to NULL when the referenced record is deleted."
23+
}
24+
]
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
datasource db {
2+
provider = "mysql"
3+
url = env("DATABASE_URL")
4+
relationMode = "prisma"
5+
}
6+
7+
model Post {
8+
id Int @id @default(autoincrement())
9+
title String
10+
author User @relation(fields: [authorId], references: [id], onDelete: <|>)
11+
authorId Int
12+
}
13+
14+
model User {
15+
id Int @id @default(autoincrement())
16+
posts Post[]
17+
}

prisma-fmt/tests/text_document_completion/tests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ scenarios! {
3535
referential_actions_in_progress_2
3636
referential_actions_middle_of_args_list
3737
referential_actions_mssql
38-
referential_actions_relation_mode_prisma
38+
referential_actions_relation_mode_prisma_mongodb
39+
referential_actions_relation_mode_prisma_mysql
40+
referential_actions_relation_mode_fk_mysql
3941
referential_actions_with_trailing_comma
4042
datasource_default_completions
4143
datasource_multischema

0 commit comments

Comments
 (0)