Templates/Travel, property & events
Real-estate listings database schema
Agents list properties for sale or rent, book viewings and take offers.
6 tables, 6 relationships
Opens as a new diagram you can change. Free.
Tables
agents
- iduuid not null
- full_nametext not null
- agencytext not null
- emailtext not null
- created_attimestamptz not null
properties
- iduuid not null
- addresstext not null
- postcodetext not null
- bedroomsinteger not null
- kindtext not null
- created_attimestamptz not null
property_listings
- iduuid not null
- property_id> propertiesuuid not null
- agent_id> agentsuuid not null
- asking_pricenumeric(12,2) not null
- for_rentboolean not null
- listed_ondate not null
- created_attimestamptz not null
buyers
- iduuid not null
- full_nametext not null
- emailtext not null
- created_attimestamptz not null
viewings
- iduuid not null
- listing_id> property_listingsuuid not null
- buyer_id> buyersuuid not null
- scheduled_attimestamptz not null
- created_attimestamptz not null
offers
- iduuid not null
- listing_id> property_listingsuuid not null
- buyer_id> buyersuuid not null
- amountnumeric(12,2) not null
- statustext 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 "agents" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"full_name" TEXT NOT NULL,
"agency" TEXT NOT NULL,
"email" TEXT NOT NULL UNIQUE,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "buyers" (
"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")
);
CREATE TABLE "offers" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"listing_id" UUID NOT NULL,
"buyer_id" UUID NOT NULL,
"amount" NUMERIC(12,2) NOT NULL,
"status" TEXT DEFAULT 'pending' NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "properties" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"address" TEXT NOT NULL,
"postcode" TEXT NOT NULL,
"bedrooms" INTEGER NOT NULL,
"kind" TEXT NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "property_listings" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"property_id" UUID NOT NULL,
"agent_id" UUID NOT NULL,
"asking_price" NUMERIC(12,2) NOT NULL,
"for_rent" BOOLEAN DEFAULT false NOT NULL,
"listed_on" DATE NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "viewings" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"listing_id" UUID NOT NULL,
"buyer_id" UUID NOT NULL,
"scheduled_at" TIMESTAMPTZ NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
ALTER TABLE "property_listings" ADD CONSTRAINT "fk_property_listings_property_id" FOREIGN KEY ("property_id") REFERENCES "properties" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "property_listings" ADD CONSTRAINT "fk_property_listings_agent_id" FOREIGN KEY ("agent_id") REFERENCES "agents" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "viewings" ADD CONSTRAINT "fk_viewings_listing_id" FOREIGN KEY ("listing_id") REFERENCES "property_listings" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "viewings" ADD CONSTRAINT "fk_viewings_buyer_id" FOREIGN KEY ("buyer_id") REFERENCES "buyers" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "offers" ADD CONSTRAINT "fk_offers_listing_id" FOREIGN KEY ("listing_id") REFERENCES "property_listings" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "offers" ADD CONSTRAINT "fk_offers_buyer_id" FOREIGN KEY ("buyer_id") REFERENCES "buyers" ("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.
- Holiday rentalsHosts' listings with availability, guest bookings and two-way reviews.
- 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.