Templates/Travel, property & events
Airline database schema
Airports, aircraft, scheduled flights, bookings, passengers and seat assignments.
6 tables, 6 relationships
Opens as a new diagram you can change. Free.
Tables
airports
- iduuid not null
- codetext not null
- nametext not null
- citytext not null
- created_attimestamptz not null
aircraft
- iduuid not null
- registrationtext not null
- modeltext not null
- seatsinteger not null
- created_attimestamptz not null
flights
- iduuid not null
- numbertext not null
- origin_id> airportsuuid not null
- destination_id> airportsuuid not null
- aircraft_id> aircraftuuid not null
- departs_attimestamptz not null
- arrives_attimestamptz not null
- created_attimestamptz not null
bookings
- iduuid not null
- referencetext not null
- contact_emailtext not null
- created_attimestamptz not null
passengers
- iduuid not null
- booking_id> bookingsuuid not null
- full_nametext not null
- passport_numbertext
- created_attimestamptz not null
tickets
- iduuid not null
- passenger_id> passengersuuid not null
- flight_id> flightsuuid not null
- fare_classtext not null
- seattext
- created_attimestamptz not null
As PostgreSQL
The same diagram exports to MySQL, MariaDB, SQLite, SQL Server and Oracle, and to Prisma, Drizzle, SQLAlchemy and Convex models.
CREATE TABLE "aircraft" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"registration" TEXT NOT NULL UNIQUE,
"model" TEXT NOT NULL,
"seats" INTEGER NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "airports" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"code" TEXT NOT NULL UNIQUE,
"name" TEXT NOT NULL,
"city" TEXT NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "bookings" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"reference" TEXT NOT NULL UNIQUE,
"contact_email" TEXT NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "flights" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"number" TEXT NOT NULL,
"origin_id" UUID NOT NULL,
"destination_id" UUID NOT NULL,
"aircraft_id" UUID NOT NULL,
"departs_at" TIMESTAMPTZ NOT NULL,
"arrives_at" TIMESTAMPTZ NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "passengers" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"booking_id" UUID NOT NULL,
"full_name" TEXT NOT NULL,
"passport_number" TEXT,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "tickets" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"passenger_id" UUID NOT NULL,
"flight_id" UUID NOT NULL,
"fare_class" TEXT NOT NULL,
"seat" TEXT,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
ALTER TABLE "flights" ADD CONSTRAINT "fk_flights_origin_id" FOREIGN KEY ("origin_id") REFERENCES "airports" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "flights" ADD CONSTRAINT "fk_flights_destination_id" FOREIGN KEY ("destination_id") REFERENCES "airports" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "flights" ADD CONSTRAINT "fk_flights_aircraft_id" FOREIGN KEY ("aircraft_id") REFERENCES "aircraft" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "passengers" ADD CONSTRAINT "fk_passengers_booking_id" FOREIGN KEY ("booking_id") REFERENCES "bookings" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "tickets" ADD CONSTRAINT "fk_tickets_passenger_id" FOREIGN KEY ("passenger_id") REFERENCES "passengers" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "tickets" ADD CONSTRAINT "fk_tickets_flight_id" FOREIGN KEY ("flight_id") REFERENCES "flights" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;More Travel, property & events templates
- Hotel bookingsHotels with room types and rooms, guest reservations and payments.
- Trip plannerTrips with travellers, destinations and a day-by-day itinerary of bookings.
- Holiday rentalsHosts' listings with availability, guest bookings and two-way reviews.
- Real-estate listingsAgents list properties for sale or rent, book viewings and take offers.
- Property managementBuildings and units, tenants on leases, rent payments and maintenance requests.
- Event ticketingEvents at venues with ticket types, orders, issued tickets and door check-ins.
- ConferenceTracks and sessions with speakers, attendee registrations and session ratings.
- Table reservationsRestaurant tables, time-slotted reservations, guests and a walk-in waitlist.
- Car rentalVehicles at branch locations, customer rentals, extras and damage reports.
Start with one diagram, free
One diagram with two branches, no card needed. Upgrade when your team needs more.