Skip to content

Commit

Permalink
[backend] Update DB schema to add tags
Browse files Browse the repository at this point in the history
  • Loading branch information
MananGandhi1810 committed Dec 7, 2024
1 parent 0c995a3 commit 7651697
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions backend/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ model ProblemStatement {
submissions Submission[]
testCase Testcase[]
editorials Editorial[]
Tag Tag? @relation(fields: [tagId], references: [id])
tagId String?
ProblemTag ProblemTag[]
}

model Testcase {
Expand All @@ -89,3 +92,19 @@ model Editorial {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model Tag {
id String @id @default(cuid())
name String
problems ProblemStatement[]
ProblemTag ProblemTag[]
}

model ProblemTag {
id String @id @default(cuid())
problem ProblemStatement @relation(fields: [problemId], references: [id], onDelete: Cascade)
problemId String
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade)
tagId String
createdAt DateTime @default(now())
}

0 comments on commit 7651697

Please sign in to comment.