Templates/Travel, property & events

Table reservations database schema

Restaurant tables, time-slotted reservations, guests and a walk-in waitlist.

5 tables, 6 relationships

Opens as a new diagram you can change. Free.

Tables

restaurants

  • iduuid not null
  • nametext not null
  • opening_hoursjsonb not null
  • created_attimestamptz not null

dining_tables

  • iduuid not null
  • restaurant_id> restaurantsuuid not null
  • labeltext not null
  • seatsinteger not null
  • created_attimestamptz not null

diners

  • iduuid not null
  • full_nametext not null
  • phonetext not null
  • created_attimestamptz not null

table_reservations

  • iduuid not null
  • restaurant_id> restaurantsuuid not null
  • table_id> dining_tablesuuid
  • diner_id> dinersuuid not null
  • party_sizeinteger not null
  • reserved_fortimestamptz not null
  • statustext not null
  • created_attimestamptz not null

waitlist_entries

  • iduuid not null
  • restaurant_id> restaurantsuuid not null
  • diner_id> dinersuuid not null
  • party_sizeinteger not null
  • seated_attimestamptz
  • 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 "diners" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "full_name" TEXT NOT NULL,
  "phone" TEXT NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "dining_tables" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "restaurant_id" UUID NOT NULL,
  "label" TEXT NOT NULL,
  "seats" INTEGER NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "restaurants" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "name" TEXT NOT NULL,
  "opening_hours" JSONB DEFAULT '{}' NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "table_reservations" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "restaurant_id" UUID NOT NULL,
  "table_id" UUID,
  "diner_id" UUID NOT NULL,
  "party_size" INTEGER NOT NULL,
  "reserved_for" TIMESTAMPTZ NOT NULL,
  "status" TEXT DEFAULT 'booked' NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "waitlist_entries" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "restaurant_id" UUID NOT NULL,
  "diner_id" UUID NOT NULL,
  "party_size" INTEGER NOT NULL,
  "seated_at" TIMESTAMPTZ,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

ALTER TABLE "dining_tables" ADD CONSTRAINT "fk_dining_tables_restaurant_id" FOREIGN KEY ("restaurant_id") REFERENCES "restaurants" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "table_reservations" ADD CONSTRAINT "fk_table_reservations_restaurant_id" FOREIGN KEY ("restaurant_id") REFERENCES "restaurants" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "table_reservations" ADD CONSTRAINT "fk_table_reservations_table_id" FOREIGN KEY ("table_id") REFERENCES "dining_tables" ("id") ON DELETE SET NULL ON UPDATE NO ACTION;

ALTER TABLE "table_reservations" ADD CONSTRAINT "fk_table_reservations_diner_id" FOREIGN KEY ("diner_id") REFERENCES "diners" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "waitlist_entries" ADD CONSTRAINT "fk_waitlist_entries_restaurant_id" FOREIGN KEY ("restaurant_id") REFERENCES "restaurants" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "waitlist_entries" ADD CONSTRAINT "fk_waitlist_entries_diner_id" FOREIGN KEY ("diner_id") REFERENCES "diners" ("id") ON DELETE NO ACTION 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.