feat(prisma): add Testcase and TestcaseData models with relation to Problem

This commit is contained in:
cfngc4594 2025-04-09 19:28:00 +08:00
parent 0f71444f9f
commit 521a185d7c

View File

@ -54,6 +54,7 @@ model Problem {
userId String userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade) user User @relation(fields: [userId], references: [id], onDelete: Cascade)
templates Template[] templates Template[]
testcases Testcase[]
@@index([userId]) @@index([userId])
@@index([difficulty]) @@index([difficulty])
@ -127,6 +128,21 @@ model JudgeResult {
memoryUsage Int? memoryUsage Int?
} }
model Testcase {
id String @id @default(cuid())
problemId String
problem Problem @relation(fields: [problemId], references: [id], onDelete: Cascade)
data TestcaseData[]
}
model TestcaseData {
id String @id @default(cuid())
label String
value String
testcaseId String
testcase Testcase @relation(fields: [testcaseId], references: [id], onDelete: Cascade)
}
model Account { model Account {
userId String userId String
type String type String