mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +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 {
|
model Problem {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
displayId Int @unique
|
displayId Int @unique
|
||||||
title String
|
titles ProblemTitle[]
|
||||||
description String
|
descriptions ProblemDescription[]
|
||||||
solution String
|
solutions ProblemSolution[]
|
||||||
difficulty Difficulty @default(EASY)
|
difficulty Difficulty @default(EASY)
|
||||||
published Boolean @default(false)
|
published Boolean @default(false)
|
||||||
userId String
|
userId String
|
||||||
@ -64,6 +64,41 @@ model Problem {
|
|||||||
@@index([difficulty])
|
@@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 {
|
enum EditorLanguage {
|
||||||
c
|
c
|
||||||
cpp
|
cpp
|
||||||
|
Loading…
Reference in New Issue
Block a user