emi-challenge-be/prisma/schema.prisma

55 lines
1020 B
Plaintext

generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
}
datasource db {
provider = "postgresql"
}
model State {
name String @id
tasks StateHistory[]
}
model Task {
id String @id @default(uuid())
title String
description String
dueDate String
completed Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
stateHistory StateHistory[]
notes Note[]
@@index([deletedAt])
}
model StateHistory {
id String @id @default(uuid())
state String
date String
taskId String
order Int
task Task @relation(fields: [taskId], references: [id], onDelete: Cascade)
stateRef State @relation(fields: [state], references: [name])
@@index([taskId])
}
model Note {
id String @id @default(uuid())
content String
taskId String
order Int
task Task @relation(fields: [taskId], references: [id], onDelete: Cascade)
@@index([taskId])
}