-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Relationship/Referential Actions #15
Comments
Referential action defaults are not available via the DMMF type during the generator step. For example take the following Prisma Schema with a Mandatory relation between model Post {
id Int @id @default(autoincrement())
title String
author User @relation(fields: [authorId], references: [id])
authorId Int
}
model User {
id Int @id @default(autoincrement())
posts Post[]
} The referential action is not explicitly definied in the schema and results in the default During the generator step Same happens for an Optional relation model Post {
id Int @id @default(autoincrement())
title String
author? User @relation(fields: [authorId], references: [id])
authorId? Int
}
model User {
id Int @id @default(autoincrement())
posts Post[]
} The referential default is During the generator step If the default are set explicitly in the schema those values are than also available during the generator step. model Post {
id Int @id @default(autoincrement())
title String
author User @relation(fields: [authorId], references: [id], onDelete: Restrict)
authorId Int
}
model User {
id Int @id @default(autoincrement())
posts Post[]
} During the generator step model Post {
id Int @id @default(autoincrement())
title String
author? User @relation(fields: [authorId], references: [id], onDelete: SetNull)
authorId? Int
}
model User {
id Int @id @default(autoincrement())
posts Post[]
} During the generator step |
Referential defaults for |
Prisma supports Referential Actions (in Preview) with release 2.26.0. Add those referential actions to the DBML output.
DMMF type
Field.relationOnDelete
includedField.relationOnUpdate
not supported #21The text was updated successfully, but these errors were encountered: