feat(todos): make Todo.product_id nullable with SetNull on delete
Todos can now exist without a product link. Changed relation from Cascade to SetNull so deleting a product doesn't delete unlinked todos. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
35ccca49c2
commit
3e949f5067
1 changed files with 2 additions and 2 deletions
|
|
@ -217,8 +217,8 @@ model Todo {
|
|||
id String @id @default(cuid())
|
||||
user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
||||
user_id String
|
||||
product Product @relation(fields: [product_id], references: [id], onDelete: Cascade)
|
||||
product_id String
|
||||
product Product? @relation(fields: [product_id], references: [id], onDelete: SetNull)
|
||||
product_id String?
|
||||
title String
|
||||
done Boolean @default(false)
|
||||
archived Boolean @default(false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue