Skip to content

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───* NOTIFICATIONS

Grouped 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
  notifications

Core entities ​

Field-level definitions and full DDL live in Schema & Migrations.

#EntityPurpose
1usersAccount
2user_identitiesIdentity verification records
3user_sessionsRefresh tokens and revocation
4user_relationshipsSocial/work/community relationship
5emergency_contactsEmergency contact list
6driver_profilesDriver-specific data
7passenger_profilesPassenger preferences
8vehiclesVehicle information
9vehicle_verificationsVehicle verification history
10recurring_journeysRecurring journey template
11journeysDriver's existing journey
12journey_routesGIS route geometry
13journey_stopsPickup/dropoff/origin/destination points
14ride_requestsPassenger request
15matchesMatching-engine result
16bookingsConfirmed shared journey
17contributionsApproved shared-cost contribution
18ratingsPost-journey feedback
19incidentsSafety / complaint events
20policy_versionsVersioned policy ruleset
21compliance_rulesConfigurable rules
22compliance_decisionsImmutable decision history
23compliance_eventsCompliance / risk events needing review
24audit_logsAppend-only activity trail
25notificationsUser/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_id references users, not driver_profiles. Ownership and driving are different facts about the same person.
  • bookings.match_id is mandatory: a booking cannot exist without the match that justified it.
  • driver_profiles.user_id and passenger_profiles.user_id are both UNIQUE, so one human cannot hold two driver profiles and slip past verification.
  • compliance_decisions and compliance_events both allow ON DELETE SET NULL on their subject references so history survives a deleted journey.

KHAWI — same route, go together.