Templates/Travel, property & events
Holiday rentals database schema
Hosts' listings with availability, guest bookings and two-way reviews.
5 tables, 6 relationships
Opens as a new diagram you can change. Free.
Tables
users
- iduuid not null
- full_nametext not null
- emailtext not null
- created_attimestamptz not null
listings
- iduuid not null
- host_id> usersuuid not null
- titletext not null
- citytext not null
- nightly_pricenumeric(8,2) not null
- max_guestsinteger not null
- created_attimestamptz not null
availability
- iduuid not null
- listing_id> listingsuuid not null
- on_datedate not null
- availableboolean not null
- price_overridenumeric(8,2)
- created_attimestamptz not null
stays
- iduuid not null
- listing_id> listingsuuid not null
- guest_id> usersuuid not null
- check_indate not null
- check_outdate not null
- totalnumeric(10,2) not null
- created_attimestamptz not null
stay_reviews
- iduuid not null
- stay_id> staysuuid not null
- author_id> usersuuid not null
- ratinginteger not null
- bodytext not null
- 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 "availability" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"listing_id" UUID NOT NULL,
"on_date" DATE NOT NULL,
"available" BOOLEAN DEFAULT true NOT NULL,
"price_override" NUMERIC(8,2),
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "listings" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"host_id" UUID NOT NULL,
"title" TEXT NOT NULL,
"city" TEXT NOT NULL,
"nightly_price" NUMERIC(8,2) NOT NULL,
"max_guests" INTEGER NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "stay_reviews" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"stay_id" UUID NOT NULL,
"author_id" UUID NOT NULL,
"rating" INTEGER NOT NULL,
"body" TEXT NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "stays" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"listing_id" UUID NOT NULL,
"guest_id" UUID NOT NULL,
"check_in" DATE NOT NULL,
"check_out" DATE NOT NULL,
"total" NUMERIC(10,2) NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "users" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"full_name" TEXT NOT NULL,
"email" TEXT NOT NULL UNIQUE,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
ALTER TABLE "listings" ADD CONSTRAINT "fk_listings_host_id" FOREIGN KEY ("host_id") REFERENCES "users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "availability" ADD CONSTRAINT "fk_availability_listing_id" FOREIGN KEY ("listing_id") REFERENCES "listings" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "stays" ADD CONSTRAINT "fk_stays_listing_id" FOREIGN KEY ("listing_id") REFERENCES "listings" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "stays" ADD CONSTRAINT "fk_stays_guest_id" FOREIGN KEY ("guest_id") REFERENCES "users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "stay_reviews" ADD CONSTRAINT "fk_stay_reviews_stay_id" FOREIGN KEY ("stay_id") REFERENCES "stays" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "stay_reviews" ADD CONSTRAINT "fk_stay_reviews_author_id" FOREIGN KEY ("author_id") REFERENCES "users" ("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.
- AirlineAirports, aircraft, scheduled flights, bookings, passengers and seat assignments.
- Trip plannerTrips with travellers, destinations and a day-by-day itinerary of bookings.
- 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.