Templates/Health

Therapy practice database schema

Clients and therapists, session bookings, private notes and assessments.

5 tables, 5 relationships

Opens as a new diagram you can change. Free.

Tables

therapists

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

clients

  • iduuid not null
  • full_nametext not null
  • emailtext not null
  • therapist_id> therapistsuuid
  • created_attimestamptz not null

therapy_sessions

  • iduuid not null
  • client_id> clientsuuid not null
  • therapist_id> therapistsuuid not null
  • starts_attimestamptz not null
  • minutesinteger not null
  • attendedboolean
  • created_attimestamptz not null

session_notes

  • iduuid not null
  • session_id> therapy_sessionsuuid not null
  • bodytext not null
  • created_attimestamptz not null

assessments

  • iduuid not null
  • client_id> clientsuuid not null
  • instrumenttext not null
  • scoreinteger not null
  • taken_ondate 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 "assessments" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "client_id" UUID NOT NULL,
  "instrument" TEXT NOT NULL,
  "score" INTEGER NOT NULL,
  "taken_on" DATE NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "clients" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "full_name" TEXT NOT NULL,
  "email" TEXT NOT NULL UNIQUE,
  "therapist_id" UUID,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "session_notes" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "session_id" UUID NOT NULL UNIQUE,
  "body" TEXT NOT NULL,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

CREATE TABLE "therapists" (
  "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 "therapy_sessions" (
  "id" UUID DEFAULT gen_random_uuid() NOT NULL,
  "client_id" UUID NOT NULL,
  "therapist_id" UUID NOT NULL,
  "starts_at" TIMESTAMPTZ NOT NULL,
  "minutes" INTEGER DEFAULT 50 NOT NULL,
  "attended" BOOLEAN,
  "created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
  PRIMARY KEY ("id")
);

ALTER TABLE "clients" ADD CONSTRAINT "fk_clients_therapist_id" FOREIGN KEY ("therapist_id") REFERENCES "therapists" ("id") ON DELETE SET NULL ON UPDATE NO ACTION;

ALTER TABLE "therapy_sessions" ADD CONSTRAINT "fk_therapy_sessions_client_id" FOREIGN KEY ("client_id") REFERENCES "clients" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "therapy_sessions" ADD CONSTRAINT "fk_therapy_sessions_therapist_id" FOREIGN KEY ("therapist_id") REFERENCES "therapists" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;

ALTER TABLE "session_notes" ADD CONSTRAINT "fk_session_notes_session_id" FOREIGN KEY ("session_id") REFERENCES "therapy_sessions" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

ALTER TABLE "assessments" ADD CONSTRAINT "fk_assessments_client_id" FOREIGN KEY ("client_id") REFERENCES "clients" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;

More Health templates

Start with one diagram, free

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