Skip to content
Snippets Groups Projects
Select Git revision
  • 7aa9e1e0fc55aa838ecdd3455b574fc528476c89
  • main default protected
  • jw_sonar
  • v6.0.0 protected
  • bedran_exercise-list
  • ask-user-to-delete-exercises-on-duplicates
  • update-dependencies
  • jw_sonar_backup
  • add_route_assignments
  • 6.0.0-dev
  • 5.0.1
  • 5.0.0
  • 4.1.0
  • 4.0.0
  • 3.5.3
  • 3.5.2
  • 3.5.1
  • 3.5.0
  • 3.4.2
  • 3.4.1
  • 3.4.0
  • 3.3.0
  • 3.2.0
  • 3.1.3
  • 3.1.2
  • 3.1.1
  • 3.1.0
  • 3.0.1
  • 3.0.0
29 results

schema.prisma

Blame
  • schema.prisma 1.86 KiB
    generator client {
        provider = "prisma-client-js"
    }
    
    datasource db {
        provider = "mysql"
        url      = env("DATABASE_URL")
    }
    
    enum UserRole {
        STUDENT
        TEACHING_STAFF
        ADMIN
    }
    
    model User {
        id             Int       @id /// The user's id is the same as their gitlab id
        name           String?
        mail           String?   @unique
        role           UserRole? @default(STUDENT)
        gitlabUsername String    @unique
        gitlabLastInfo Json      @default("{}") @db.Json
        deleted        Boolean   @default(false)
    
        assignments Assignment[]
        exercises   Exercise[]
    }
    
    model Assignment {
        name               String   @id
        gitlabId           Int
        gitlabLink         String
        gitlabCreationInfo Json     @db.Json
        gitlabLastInfo     Json     @db.Json
        gitlabLastInfoDate DateTime
        published          Boolean  @default(false)
    
        exercises Exercise[]
        staff     User[]
    }
    
    model Exercise {
        id                 String   @id @db.Char(36)
        assignmentName     String
        name               String
        secret             String   @unique @db.Char(36)
        gitlabId           Int
        gitlabLink         String
        gitlabCreationInfo Json     @db.Json
        gitlabLastInfo     Json     @db.Json
        gitlabLastInfoDate DateTime
    
        correctionCommit      Json?   @db.Json
        correctionDescription String? @db.VarChar(80)
    
        assignment Assignment @relation(fields: [assignmentName], references: [name], onDelete: NoAction, onUpdate: Cascade)
    
        members User[]
        results Result[]
    }
    
    model Result {
        exerciseId String   @db.Char(36)
        dateTime   DateTime @default(now())
        success    Boolean
        exitCode   Int
        commit     Json     @db.Json
        results    Json     @db.Json
        files      Json     @db.Json
    
        exercise Exercise @relation(fields: [exerciseId], references: [id], onDelete: Cascade, onUpdate: Cascade)
    
        @@id([exerciseId, dateTime])
    }