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:
Janpeter Visser 2026-04-25 18:42:47 +02:00
parent ab880e0b1f
commit 6c7459c61f

View file

@ -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)