Skip to content

Commit

Permalink
Add ProblemVariable table
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatehito committed Mar 1, 2024
1 parent 43b2ed2 commit 9402c1f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- CreateTable
CREATE TABLE "ProblemVariable" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
"userProblemSessionId" INTEGER NOT NULL,
"position" INTEGER NOT NULL,
"value" INTEGER NOT NULL,
CONSTRAINT "ProblemVariable_userProblemSessionId_fkey" FOREIGN KEY ("userProblemSessionId") REFERENCES "UserProblemSession" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
19 changes: 16 additions & 3 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ model UserProblemSession {
user User @relation(fields: [userId], references: [id])
userId String
courseId String
programId String
languageId String
courseId String
programId String
languageId String
problemVariables ProblemVariable[]
currentProblemType String
currentStep Int
Expand All @@ -42,6 +43,18 @@ model UserProblemSession {
isCompleted Boolean
}

model ProblemVariable {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userProblemSession UserProblemSession @relation(fields: [userProblemSessionId], references: [id])
userProblemSessionId Int
position Int
value Int
}

model UserCompletedProblem {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
Expand Down

0 comments on commit 9402c1f

Please sign in to comment.