Templates/Travel, property & events
Car rental database schema
Vehicles at branch locations, customer rentals, extras and damage reports.
6 tables, 7 relationships
Opens as a new diagram you can change. Free.
Tables
branches
- iduuid not null
- nametext not null
- citytext not null
- created_attimestamptz not null
rental_vehicles
- iduuid not null
- branch_id> branchesuuid not null
- registrationtext not null
- categorytext not null
- daily_ratenumeric(8,2) not null
- created_attimestamptz not null
renters
- iduuid not null
- full_nametext not null
- emailtext not null
- licence_numbertext not null
- created_attimestamptz not null
rentals
- iduuid not null
- vehicle_id> rental_vehiclesuuid not null
- renter_id> rentersuuid not null
- pickup_branch_id> branchesuuid not null
- return_branch_id> branchesuuid not null
- picks_up_attimestamptz not null
- returns_attimestamptz not null
- created_attimestamptz not null
rental_extras
- iduuid not null
- rental_id> rentalsuuid not null
- nametext not null
- pricenumeric(8,2) not null
- created_attimestamptz not null
damage_reports
- iduuid not null
- rental_id> rentalsuuid not null
- descriptiontext not null
- photo_urltext
- 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 "branches" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"name" TEXT NOT NULL,
"city" TEXT NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "damage_reports" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"rental_id" UUID NOT NULL,
"description" TEXT NOT NULL,
"photo_url" TEXT,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "rental_extras" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"rental_id" UUID NOT NULL,
"name" TEXT NOT NULL,
"price" NUMERIC(8,2) NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "rental_vehicles" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"branch_id" UUID NOT NULL,
"registration" TEXT NOT NULL UNIQUE,
"category" TEXT NOT NULL,
"daily_rate" NUMERIC(8,2) NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "rentals" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"vehicle_id" UUID NOT NULL,
"renter_id" UUID NOT NULL,
"pickup_branch_id" UUID NOT NULL,
"return_branch_id" UUID NOT NULL,
"picks_up_at" TIMESTAMPTZ NOT NULL,
"returns_at" TIMESTAMPTZ NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "renters" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"full_name" TEXT NOT NULL,
"email" TEXT NOT NULL UNIQUE,
"licence_number" TEXT NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
ALTER TABLE "rental_vehicles" ADD CONSTRAINT "fk_rental_vehicles_branch_id" FOREIGN KEY ("branch_id") REFERENCES "branches" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "rentals" ADD CONSTRAINT "fk_rentals_vehicle_id" FOREIGN KEY ("vehicle_id") REFERENCES "rental_vehicles" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "rentals" ADD CONSTRAINT "fk_rentals_renter_id" FOREIGN KEY ("renter_id") REFERENCES "renters" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "rentals" ADD CONSTRAINT "fk_rentals_pickup_branch_id" FOREIGN KEY ("pickup_branch_id") REFERENCES "branches" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "rentals" ADD CONSTRAINT "fk_rentals_return_branch_id" FOREIGN KEY ("return_branch_id") REFERENCES "branches" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "rental_extras" ADD CONSTRAINT "fk_rental_extras_rental_id" FOREIGN KEY ("rental_id") REFERENCES "rentals" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "damage_reports" ADD CONSTRAINT "fk_damage_reports_rental_id" FOREIGN KEY ("rental_id") REFERENCES "rentals" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;More Travel, property & events templates
- Hotel bookingsHotels with room types and rooms, guest reservations and payments.
- AirlineAirports, aircraft, scheduled flights, bookings, passengers and seat assignments.
- 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.
Start with one diagram, free
One diagram with two branches, no card needed. Upgrade when your team needs more.