Attendance
A class register: one header row per (class, date), and a child row per
student who was present. Absence is the absence of a row — the header's
roster minus its attendance_students.
| Table | Columns (keys) | Notes |
|---|---|---|
attendance |
id PK · class_id FK · date · created_by · created_at · UNIQUE(class_id, date) |
the uniqueness constraint is the "one register per class per day" rule; re-taking attendance edits the same header |
attendance_students |
id PK · attendance_id FK (ON DELETE CASCADE) · student_id FK · UNIQUE(attendance_id, student_id) |
present-only rows; deleting the header cascades them away |
Relationships
classes 1 —< attendance 1 —< attendance_students >— students.
Access
Teachers write attendance for their own classes (scope assigned); the
all-attendance monitor (GET /attendance) is gated attendance read but has a
scope guard inside the handler so only unrestricted roles see every class. A
parent at scope own sees only their children's rows. The attendance summary
report aggregates the same two tables.
Rendered from simple-lms/data-model/attendance.md · OKF bundle · regenerate with npm run render