feat(db): make Todo.product_id non-nullable, cascade on product delete
Aligns schema with the API and server action, both of which already require product_id. Changes onDelete from SetNull to Cascade — deleting a product now also removes its todos. Run: npx prisma db push Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ab880e0b1f
commit
6c7459c61f
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: SetNull)
|
||||
product_id String?
|
||||
product Product @relation(fields: [product_id], references: [id], onDelete: Cascade)
|
||||
product_id String
|
||||
title String
|
||||
done Boolean @default(false)
|
||||
archived Boolean @default(false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue