generator client { provider = "prisma-client-js" } datasource db { provider = "mysql" url = env("DATABASE_URL") } model User { id Int @id @default(autoincrement()) name String username String @unique email String @unique passwordHash String role String objectives Objective[] createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } model Objective { id Int @id @default(autoincrement()) title String description String? ownerId Int owner User @relation(fields: [ownerId], references: [id]) quarter String status String @default("NOT_STARTED") keyResults KeyResult[] createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@index([ownerId]) @@index([quarter]) @@index([status]) } model KeyResult { id Int @id @default(autoincrement()) objectiveId Int objective Objective @relation(fields: [objectiveId], references: [id], onDelete: Cascade) title String progress Int @default(0) startValue Int targetValue Int deadline DateTime updates ProgressUpdate[] createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@index([objectiveId]) } model ProgressUpdate { id Int @id @default(autoincrement()) keyResultId Int keyResult KeyResult @relation(fields: [keyResultId], references: [id], onDelete: Cascade) progress Int comment String? createdById Int createdAt DateTime @default(now()) }