mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-17 23:12:23 +00:00
feat(prisma/schema): add multilingual support for problem descriptions and solutions
BREAKING CHANGE: - Removed `description` and `solution` fields from Problem model - Added new models `ProblemDescription` and `ProblemSolution` with language support (EN/ZH) - Updated seed data structure to support multilingual content - Requires database migration and data migration from old structure
This commit is contained in:
parent
f0beb69b2c
commit
cfbbdbf821
@ -47,9 +47,9 @@ enum Difficulty {
|
||||
model Problem {
|
||||
id String @id @default(cuid())
|
||||
displayId Int @unique
|
||||
title String
|
||||
description String
|
||||
solution String
|
||||
titles ProblemTitle[]
|
||||
descriptions ProblemDescription[]
|
||||
solutions ProblemSolution[]
|
||||
difficulty Difficulty @default(EASY)
|
||||
published Boolean @default(false)
|
||||
userId String
|
||||
@ -64,6 +64,41 @@ model Problem {
|
||||
@@index([difficulty])
|
||||
}
|
||||
|
||||
enum Language {
|
||||
en
|
||||
zh
|
||||
}
|
||||
|
||||
model ProblemTitle {
|
||||
id String @id @default(cuid())
|
||||
language Language
|
||||
content String
|
||||
problemId String
|
||||
problem Problem @relation(fields: [problemId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([problemId, language])
|
||||
}
|
||||
|
||||
model ProblemDescription {
|
||||
id String @id @default(cuid())
|
||||
language Language
|
||||
content String
|
||||
problemId String
|
||||
problem Problem @relation(fields: [problemId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([problemId, language])
|
||||
}
|
||||
|
||||
model ProblemSolution {
|
||||
id String @id @default(cuid())
|
||||
language Language
|
||||
content String
|
||||
problemId String
|
||||
problem Problem @relation(fields: [problemId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([problemId, language])
|
||||
}
|
||||
|
||||
enum EditorLanguage {
|
||||
c
|
||||
cpp
|
||||
|
Loading…
Reference in New Issue
Block a user