use them if you need add other props to relation as timestamp or quantity, or if you need more flexible queries
model Post { id Int @id @default(autoincrement()) title String tags PostTag[]}model Tag { id Int @id @default(autoincrement()) posts PostTag[]}model PostTag { postId Int post Post @relation(fields: [postId], references: [id]) tagId Int post Tag @relation(fields: [tagId], references: [id]) @@id([postId, tagId])}
Behavior: The default behavior is to take no action on update or delete. This means that if a referenced record is updated or deleted, no automatic action is taken on the referencing records.
Example: If a user is updated or deleted, any posts referencing that user remain unchanged
Cascade
Behavior: When the referenced record is updated or deleted, the changes are cascaded to the referencing records. This often involves updating or deleting the referencing records automatically.
Example: If updating a user’s ID cascades to update the corresponding user ID in all associated posts.
Set Null
Behavior: When the referenced record is updated or deleted, the foreign key in the referencing records is set to null.
Example: If a user is deleted, set the user ID in all associated posts to null.
Draw with stylusDraw a lineDraw an arrowDraw an ellipseDraw a rectangleErase