Templates/Travel, property & events

Trip planner database schema

Trips with travellers, destinations and a day-by-day itinerary of bookings.

6 tables, 6 relationships

Opens as a new diagram you can change. Free.

Tables

travellers

  • iduuid not null
  • full_nametext not null
  • emailtext not null
  • created_attimestamptz not null

trips

  • iduuid not null
  • owner_id> travellersuuid not null
  • nametext not null
  • starts_ondate not null
  • ends_ondate not null
  • created_attimestamptz not null

trip_members

  • iduuid not null
  • trip_id> tripsuuid not null
  • traveller_id> travellersuuid not null
  • created_attimestamptz not null

destinations

  • iduuid not null
  • nametext not null
  • countrytext not null
  • created_attimestamptz not null

itinerary_items

  • iduuid not null
  • trip_id> tripsuuid not null
  • destination_id> destinationsuuid
  • titletext not null
  • starts_attimestamptz not null
  • kindtext not null
  • created_attimestamptz not null

travel_bookings

  • iduuid not null
  • item_id> itinerary_itemsuuid not null
  • providertext not null
  • confirmation_codetext
  • costnumeric(10,2)
  • 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 "destinations" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "name" TEXT NOT NULL,
  "country" TEXT NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "itinerary_items" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "trip_id" UUID NOT NULL,
  "destination_id" UUID,
  "title" TEXT NOT NULL,
  "starts_at" TIMESTAMPTZ NOT NULL,
  "kind" TEXT NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "travel_bookings" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "item_id" UUID NOT NULL,
  "provider" TEXT NOT NULL,
  "confirmation_code" TEXT,
  "cost" NUMERIC(10,2),
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "travellers" (
  "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 "trip_members" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "trip_id" UUID NOT NULL,
  "traveller_id" UUID NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "trips" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "owner_id" UUID NOT NULL,
  "name" TEXT NOT NULL,
  "starts_on" DATE NOT NULL,
  "ends_on" DATE NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

ALTER TABLE "trips" ADD CONSTRAINT "fk_trips_owner_id" FOREIGN KEY ("owner_id") REFERENCES "travellers" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "trip_members" ADD CONSTRAINT "fk_trip_members_trip_id" FOREIGN KEY ("trip_id") REFERENCES "trips" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "trip_members" ADD CONSTRAINT "fk_trip_members_traveller_id" FOREIGN KEY ("traveller_id") REFERENCES "travellers" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "itinerary_items" ADD CONSTRAINT "fk_itinerary_items_trip_id" FOREIGN KEY ("trip_id") REFERENCES "trips" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "itinerary_items" ADD CONSTRAINT "fk_itinerary_items_destination_id" FOREIGN KEY ("destination_id") REFERENCES "destinations" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "travel_bookings" ADD CONSTRAINT "fk_travel_bookings_item_id" FOREIGN KEY ("item_id") REFERENCES "itinerary_items" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

More Travel, property & events templates

Start with one diagram, free

One diagram with two branches, no card needed. Upgrade when your team needs more.