Calendar & scheduling database schema
Calendars, events with attendees, recurrence rules and reminders.
6 tables, 6 relationships
Opens as a new diagram you can change. Free.
Tables
users
- iduuid not null
- emailtext not null
- timezonetext not null
- created_attimestamptz not null
calendars
- iduuid not null
- owner_id> usersuuid not null
- nametext not null
- colortext not null
- created_attimestamptz not null
calendar_events
- iduuid not null
- calendar_id> calendarsuuid not null
- titletext not null
- starts_attimestamptz not null
- ends_attimestamptz not null
- locationtext
- created_attimestamptz not null
recurrence_rules
- iduuid not null
- event_id> calendar_eventsuuid not null
- rruletext not null
- untiltimestamptz
- created_attimestamptz not null
attendees
- iduuid not null
- event_id> calendar_eventsuuid not null
- user_id> usersuuid
- emailtext not null
- responsetext not null
- created_attimestamptz not null
reminders
- iduuid not null
- event_id> calendar_eventsuuid not null
- minutes_beforeinteger not null
- channeltext 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 "attendees" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"event_id" UUID NOT NULL,
"user_id" UUID,
"email" TEXT NOT NULL,
"response" TEXT DEFAULT 'needs_action' NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "calendar_events" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"calendar_id" UUID NOT NULL,
"title" TEXT NOT NULL,
"starts_at" TIMESTAMPTZ NOT NULL,
"ends_at" TIMESTAMPTZ NOT NULL,
"location" TEXT,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "calendars" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"owner_id" UUID NOT NULL,
"name" TEXT NOT NULL,
"color" TEXT NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "recurrence_rules" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"event_id" UUID NOT NULL UNIQUE,
"rrule" TEXT NOT NULL,
"until" TIMESTAMPTZ,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "reminders" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"event_id" UUID NOT NULL,
"minutes_before" INTEGER NOT NULL,
"channel" TEXT DEFAULT 'email' NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "users" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"email" TEXT NOT NULL UNIQUE,
"timezone" TEXT DEFAULT 'Europe/London' NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
ALTER TABLE "calendars" ADD CONSTRAINT "fk_calendars_owner_id" FOREIGN KEY ("owner_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "calendar_events" ADD CONSTRAINT "fk_calendar_events_calendar_id" FOREIGN KEY ("calendar_id") REFERENCES "calendars" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "recurrence_rules" ADD CONSTRAINT "fk_recurrence_rules_event_id" FOREIGN KEY ("event_id") REFERENCES "calendar_events" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "attendees" ADD CONSTRAINT "fk_attendees_event_id" FOREIGN KEY ("event_id") REFERENCES "calendar_events" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "attendees" ADD CONSTRAINT "fk_attendees_user_id" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "reminders" ADD CONSTRAINT "fk_reminders_event_id" FOREIGN KEY ("event_id") REFERENCES "calendar_events" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;More Work & productivity templates
- Projects & tasksWorkspaces, projects and tasks with assignees, labels and comments.
- Kanban boardBoards with columns of cards, members and checklists.
- CRMCompanies, contacts, deals moving through pipeline stages, and activities.
- Help deskCustomer tickets, threaded messages, agents, SLA policies and tags.
- HR & peopleEmployees in departments and positions, reporting lines, leave and salary history.
- Applicant trackingJob openings, candidates, applications through stages, interviews and scorecards.
- Time trackingClients, projects and tasks with time entries that bill into invoices.
- OKRs & goalsTeams set objectives with measurable key results and regular check-ins.
- Document e-signatureDocuments sent to signers, signature fields, signatures and an audit trail.
- Task lists (Firestore)Workspaces, their projects and tasks, with due-date queries indexed and finished tasks expiring.
Start with one diagram, free
One diagram with two branches, no card needed. Upgrade when your team needs more.