Skip to content

Database schema

Sampo Hippeläinen edited this page Dec 12, 2019 · 6 revisions

Database schema

Table CourseInstances {
    id int [pk]
    name string
    start timestamp
    end timestamp
    active boolean
    weekAmount int
    weekMaxPoints double
    currentWeek int
    currentCodeReview "int[]"
    amountOfCodeReviews int
    codeReviewActive boolean
    finalReview boolean
    ohid string
    coursesPage string
    coursesMaterial string
}

Table Users {
    id int [pk]
    username string
    email string
    firsts string
    lastname string
    token string
    studentNumber string
    teacher boolean
    sysop boolean
}

Table StudentInstances {
    id int [pk]
    userId int [not null, ref: > Users.id]
    courseInstanceId int [not null, ref: > CourseInstances.id]
    teacherInstanceId int [ref: > TeacherInstances.id]
    github string
    projectName string
    dropped boolean
    issuesDisabled boolean
    issuesDisabledCheckedAt timestamp
    validRegistration boolean
    repoExists boolean [null]
}

Table TeacherInstances {
    id int [pk]
    userId int [ref: > Users.id]
    courseInstanceId int [ref: > CourseInstances.id]
    instructor boolean
}

Table Weeks {
    id int [pk]
    studentInstanceId int [not null, ref: > StudentInstances.id]
    points double [null]
    grade int [null]
    weekNumber int
    feedback string
    notified boolean
    instructorNotes string
}

Table Tags {
    id int [pk]
    name string
    color string
    courseInstanceId int [not null, ref: > CourseInstances.id]
}

Table StudentTags {
    id int [pk]
    studentInstanceId int [not null, ref: > StudentInstances.id]
    tagId int [not null, ref: > Tags.id]
}

Table Comments {
    id int [pk]
    comment string
    hidden boolean
    weekId int
    from string
    userId int [ref: > Users.id]
    notified boolean
    isRead "int[]"
}

Table CodeReviews {
    id int [pk]
    studentInstanceId int [ref: > StudentInstances.id]
    points double
    reviewNumber int
    linkToReview string
    toReview int [null, ref: > StudentInstances.id]
    repoToReview string [null]
}

Table Checklists {
    id int [pk]
    courseInstanceId int [ref: > CourseInstances.id]
    master boolean
    maxPoints double
    week int [null]
    forCodeReview boolean
}

Table ChecklistItems {
    id int [pk]
    checklistId int [ref: > Checklists.id]
    name string
    textWhenOff string
    textWhenOn string
    checkedPoints double
    uncheckedPoints double
    category string
    order int
    minimumRequirement boolean
    minimumRequirementMetIf boolean
    minimumRequirementGradePenalty int
    prerequisite int [ref: > ChecklistItems.id]
}

Table ReviewChecks {
    id int [pk]
    ChecklistItemId int [ref: > ChecklistItems.id]
    checked boolean
    weekId int [null, ref: > Weeks.id]
    codeReviewId int [null, ref: > CodeReviews.id]
}

Table WeekDrafts {
    id int [pk]
    studentInstanceId int [ref: > StudentInstances.id]
    weekNumber int
    data json
}