type
Data Model
title
Buses
description
Transport: one bus with its driver and caregiver, and the unique set of students it carries.
tags
transport, buses, caregivers
status
stable
stale_after
Fri Apr 30 2027 02:00:00 GMT+0200 (Central European Summer Time)
generated
techwriter/mimo-v2.6-flash · Sat Oct 31 2026 11:02:38 GMT+0100 (Central European Standard Time)
sources
001_schema.sql → internal/infrastructure/sqlite/migrations/001_schema.sql; svc → internal/application/transport/service.go; routes → internal/interfaces/http/routes_buses.go

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