refactoring

This commit is contained in:
simon.franken
2026-02-18 10:26:15 +01:00
parent 27ec450d3b
commit 6a6a3ba00b
18 changed files with 386 additions and 371 deletions

View File

@@ -0,0 +1,4 @@
-- Remove the erroneous UNIQUE constraint on ongoing_timers.project_id.
-- Multiple users must be able to have concurrent timers on the same project.
-- The one-timer-per-user constraint is correctly enforced by the UNIQUE on user_id.
DROP INDEX IF EXISTS "ongoing_timers_project_id_key";

View File

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