Restore onDelete: Cascade on Project->Client and TimeEntry->Project

Direct database deletes should still cascade to avoid orphaned records.
The migration now only adds the three deleted_at columns without touching
the existing FK constraints.
This commit is contained in:
simon.franken
2026-02-23 15:32:31 +01:00
parent 159022ef38
commit 1b0f5866a1
2 changed files with 2 additions and 14 deletions

View File

@@ -53,7 +53,7 @@ model Project {
userId String @map("user_id") @db.VarChar(255)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
clientId String @map("client_id")
client Client @relation(fields: [clientId], references: [id])
client Client @relation(fields: [clientId], references: [id], onDelete: Cascade)
timeEntries TimeEntry[]
ongoingTimers OngoingTimer[]
@@ -76,7 +76,7 @@ model TimeEntry {
userId String @map("user_id") @db.VarChar(255)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
projectId String @map("project_id")
project Project @relation(fields: [projectId], references: [id])
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
@@index([userId])
@@index([userId, startTime])