eduproj/prisma/schema.prisma

93 lines
2.1 KiB
Text
Raw Normal View History

2021-12-28 07:01:39 +00:00
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
2021-12-28 07:12:59 +00:00
provider = "sqlite"
url = "file:./test.db"
2021-12-28 07:01:39 +00:00
}
model User {
2021-12-29 08:29:09 +00:00
id Int @id @default(autoincrement())
email String @unique
name String?
passwordHash String
solvedExercises ExerciseInstance[]
apiKeys ApiKey[]
}
model ApiKey {
key String @id @default(uuid())
expires DateTime @default(now())
scopes String // JSON array of scopes
owner User @relation(fields: [ownerId], references: [id])
ownerId Int
}
model Page {
id Int @id @default(autoincrement())
}
model Concept {
name String @id
exercises ExerciseConceptSat[]
}
model Exercise {
name String @id
concepts ExerciseConceptSat[]
instances ExerciseInstance[]
isGroup Boolean
children Exercise[] @relation("Lineage")
parent Exercise? @relation("Lineage", fields: [parentName], references: [name])
parentName String?
// https://github.com/prisma/prisma/issues/3786
graderConfig String?
}
model ExerciseInstance {
id Int @id @default(autoincrement())
exercise Exercise @relation(fields: [exerciseName], references: [name])
exerciseName String
user User @relation(fields: [userId], references: [id])
userId Int
job Job? @relation(fields: [jobId], references: [id])
jobId Int?
}
model Job {
id Int @id @default(autoincrement())
timeSubmitted DateTime @default(now())
timeClaimed DateTime
timeoutSeconds Int
timeCompleted DateTime?
gradingProgress String // JSON progress information
gradingStatus String
gradingVerdict String
gradingFeedback String // JSON
ExerciseInstance ExerciseInstance[]
}
model ExerciseConceptSat {
exercise Exercise @relation(fields: [exerciseName], references: [name])
exerciseName String
concept Concept @relation(fields: [conceptName], references: [name])
conceptName String
satisfiesFactor Float
@@id([exerciseName, conceptName])
2021-12-28 07:01:39 +00:00
}