ERD & Core Entities
Entity relationship diagram
text
USERS 1───1 DRIVER_PROFILE
USERS 1───1 PASSENGER_PROFILE
USERS 1───* USER_IDENTITIES
USERS 1───* USER_SESSIONS
USERS 1───* EMERGENCY_CONTACTS
USERS *───* USERS (USER_RELATIONSHIPS)
USERS 1───* VEHICLES (owner_user_id)
USERS 1───* JOURNEYS (driver_id)
USERS 1───* RIDE_REQUESTS (passenger_id)
VEHICLES 1───* VEHICLE_VERIFICATIONS
VEHICLES 1───* RECURRING_JOURNEYS
RECURRING_JOURNEYS 1───* JOURNEYS
JOURNEYS 1───1 JOURNEY_ROUTES
JOURNEYS 1───* JOURNEY_STOPS
JOURNEYS 1───* RIDE_REQUESTS (via MATCHES)
RIDE_REQUESTS 1───* MATCHES
MATCHES 1───* BOOKINGS
BOOKINGS 1───* CONTRIBUTIONS
BOOKINGS 1───1 RATINGS
BOOKINGS 1───* INCIDENTS
COMPLIANCE_RULES 1───* COMPLIANCE_EVENTS
POLICY_VERSIONS 1───* COMPLIANCE_RULES
POLICY_VERSIONS 1───* COMPLIANCE_DECISIONS
JOURNEYS 1───* COMPLIANCE_DECISIONS
USERS 1───* NOTIFICATIONSGrouped schema
text
identity
users
user_identities
user_sessions
user_relationships
emergency_contacts
participants
driver_profiles
passenger_profiles
vehicles
vehicles
vehicle_verifications
journeys
recurring_journeys
journeys
journey_routes
journey_stops
matching
ride_requests
matches
booking
bookings
contributions
ratings
safety
incidents
compliance
policy_versions
compliance_rules
compliance_decisions
compliance_events
audit
audit_logs
notificationsCore entities
Field-level definitions and full DDL live in Schema & Migrations.
| # | Entity | Purpose |
|---|---|---|
| 1 | users | Account |
| 2 | user_identities | Identity verification records |
| 3 | user_sessions | Refresh tokens and revocation |
| 4 | user_relationships | Social/work/community relationship |
| 5 | emergency_contacts | Emergency contact list |
| 6 | driver_profiles | Driver-specific data |
| 7 | passenger_profiles | Passenger preferences |
| 8 | vehicles | Vehicle information |
| 9 | vehicle_verifications | Vehicle verification history |
| 10 | recurring_journeys | Recurring journey template |
| 11 | journeys | Driver's existing journey |
| 12 | journey_routes | GIS route geometry |
| 13 | journey_stops | Pickup/dropoff/origin/destination points |
| 14 | ride_requests | Passenger request |
| 15 | matches | Matching-engine result |
| 16 | bookings | Confirmed shared journey |
| 17 | contributions | Approved shared-cost contribution |
| 18 | ratings | Post-journey feedback |
| 19 | incidents | Safety / complaint events |
| 20 | policy_versions | Versioned policy ruleset |
| 21 | compliance_rules | Configurable rules |
| 22 | compliance_decisions | Immutable decision history |
| 23 | compliance_events | Compliance / risk events needing review |
| 24 | audit_logs | Append-only activity trail |
| 25 | notifications | User/system notifications |
Naming rules
There is no routes table and no trips table.
- The driver's supply is a journey. A journey is created by a driver, always has a driver and a vehicle, and exists whether or not anyone boards.
- The confirmed shared journey is a booking. It is the outcome of a match, not a dispatched job.
- The passenger's want is a ride request. It expresses demand and never creates supply.
Naming a journey a "route" or a booking a "trip" reintroduces a dispatch model the platform deliberately does not have.
Referential integrity notes
vehicles.owner_user_idreferencesusers, notdriver_profiles. Ownership and driving are different facts about the same person.bookings.match_idis mandatory: a booking cannot exist without the match that justified it.driver_profiles.user_idandpassenger_profiles.user_idare bothUNIQUE, so one human cannot hold two driver profiles and slip past verification.compliance_decisionsandcompliance_eventsboth allowON DELETE SET NULLon their subject references so history survives a deleted journey.
