Buses
School transport. A bus names its driver and optionally assigns a caregiver
— a users.id, typically a user with the teacher role — and its students are
linked in a join table that enforces one bus per student.
| Table | Columns (keys) | Notes |
|---|---|---|
buses |
id PK · bus_number UNIQUE · driver_name · driver_phone · caregiver_id FK→users (nullable) · created_at |
the caregiver is a host user, not a separate account type |
bus_students |
id PK · bus_id FK (ON DELETE CASCADE) · student_id FK (ON DELETE CASCADE) · UNIQUE(student_id) |
the unique constraint is the business rule: a student rides exactly one bus; assigning elsewhere re-points the row |
Relationships
buses 1 —< bus_students >— students; buses >— users (caregiver).
Access
The buses resource is read/write/delete for manager and read for accountant;
no scoped role holds it by default. Assignment happens through the bus form
(searchable multi-select of students), gated buses write.
Rendered from simple-lms/data-model/buses.md · OKF bundle · regenerate with npm run render