Skip to content
Spiros Papadimitriou edited this page Mar 23, 2026 · 1 revision

Entity-Relationship Diagram

erDiagram
    classroom_orgs {
        number id PK "GitHub org ID"
        string name UK "max 64, not null"
        string description "max 64, nullable"
        number installation_id "nullable, GitHub app installation ID"
    }

    users {
        number id PK "GitHub user ID"
        string username UK "max 32, not null"
        string sisId UK "max 32, nullable"
        enum role "admin | member, default member"
        string name "max 128, nullable"
    }

    memberships {
        number userid PK, FK "references users.id"
        number orgId PK, FK "references classroom_orgs.id"
    }

    assignments {
        number id PK "auto-increment"
        number orgId FK "not null, references classroom_orgs.id"
        string name "max 64, not null"
        string starter_repo "max 64, not null"
        string repo_slug "max 64, not null"
        date due "nullable"
    }

    sessions {
        string id PK "max 255, session ID"
        date expires "not null"
        json cookie "not null"
        number userid FK "nullable, references users.id"
        string username "max 32, nullable"
    }

    accepted_assignments {
        number userid PK, FK "not null, references users.id"
        number assignment_id PK, FK "not null, references assignments.id"
        string repo "max 64, not null"
        date date "nullable"
    }

    submissions {
        number id PK "auto-increment"
        date timestamp "not null, indexed"
        number userid FK "not null, references users.id"
        number assignment_id FK "not null, references assignments.id"
        number score "nullable"
        number max_score "nullable"
    }

    code_submissions {
        number id PK, FK "references submissions.id"
        string repo "max 64, not null"
        string head_sha UK "max 40, not null"
        enum scored_by "action | bot, nullable"
        bigint check_run_id "nullable"
        enum status "failure | neutral | success | timed_out"
        float execution_time "nullable"
        json autograde "nullable"
    }

    alerts {
        number id PK "auto-increment"
        date timestamp "not null, indexed"
        boolean cleared "not null, default false"
        number userid FK "nullable, references users.id"
        number assignment_id FK "nullable, references assignments.id"
        string repo "max 64, not null"
        number issue "nullable"
        string sha UK "max 40, not null"
        json details "nullable"
    }

    classroom_orgs ||--o{ assignments : ""
    classroom_orgs }o--o{ users : "memberships"
    users ||--o{ sessions : ""
    users ||--o{ submissions : ""
    users ||--o{ alerts : ""
    users ||--o{ accepted_assignments : ""
    assignments ||--o{ accepted_assignments : ""
    assignments ||--o{ submissions : ""
    assignments ||--o{ alerts : ""
    submissions ||--o| code_submissions : ""
    submissions }o--o| accepted_assignments : ""
Loading

Clone this wiki locally