flights table
The flights table in the Airline Reservation Database Schema schema has 12 columns, keyed by id, with 2 foreign keys to routes and aircraft. 6 columns in flight_status_events, crew_assignments, flight_inventory, booking_segments and 2 more reference it.
One dated instance of a route. aircraft_id is nullable because tail assignment happens close to departure and can change.
Columns (12)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| route_id | uuid | not null, references routes.id | |
| aircraft_id | uuid | references aircraft.id | |
| departure_date | date | not null | |
| scheduled_departure | timestamptz | not null | |
| scheduled_arrival | timestamptz | not null | |
| estimated_departure | timestamptz | ||
| actual_departure | timestamptz | ||
| actual_arrival | timestamptz | ||
| status | flight_status | not null | |
| gate | varchar(10) | ||
| terminal | varchar(10) |
Indexes (3)
(route_id, departure_date)unique(departure_date, status)(scheduled_departure)
Relationships
flights.route_idreferencesroutes.idflights.aircraft_idreferencesaircraft.idflight_status_events.flight_idreferencesflightscrew_assignments.flight_idreferencesflightsflight_inventory.flight_idreferencesflightsbooking_segments.flight_idreferencesflightswaitlists.flight_idreferencesflightsdisruptions.flight_idreferencesflights