// 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 { provider = "sqlite" url = "file:./test.db" } model User { 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]) }