Nursery / childcare database schema
Children in rooms with key staff, guardians, daily attendance and incident reports.
7 tables, 8 relationships
Opens as a new diagram you can change. Free.
Tables
rooms
- iduuid not null
- nametext not null
- capacityinteger not null
- created_attimestamptz not null
staff
- iduuid not null
- full_nametext not null
- room_id> roomsuuid
- created_attimestamptz not null
children
- iduuid not null
- full_nametext not null
- date_of_birthdate not null
- room_id> roomsuuid not null
- key_person_id> staffuuid
- allergiestext
- created_attimestamptz not null
guardians
- iduuid not null
- full_nametext not null
- phonetext not null
- created_attimestamptz not null
child_guardians
- iduuid not null
- child_id> childrenuuid not null
- guardian_id> guardiansuuid not null
- can_collectboolean not null
- created_attimestamptz not null
child_attendance
- iduuid not null
- child_id> childrenuuid not null
- arrived_attimestamptz not null
- left_attimestamptz
- created_attimestamptz not null
incidents
- iduuid not null
- child_id> childrenuuid not null
- staff_id> staffuuid not null
- descriptiontext not null
- guardian_informed_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 "child_attendance" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"child_id" UUID NOT NULL,
"arrived_at" TIMESTAMPTZ NOT NULL,
"left_at" TIMESTAMPTZ,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "child_guardians" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"child_id" UUID NOT NULL,
"guardian_id" UUID NOT NULL,
"can_collect" BOOLEAN DEFAULT true NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "children" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"full_name" TEXT NOT NULL,
"date_of_birth" DATE NOT NULL,
"room_id" UUID NOT NULL,
"key_person_id" UUID,
"allergies" TEXT,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "guardians" (
"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 "incidents" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"child_id" UUID NOT NULL,
"staff_id" UUID NOT NULL,
"description" TEXT NOT NULL,
"guardian_informed_at" TIMESTAMPTZ,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "rooms" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"name" TEXT NOT NULL,
"capacity" INTEGER NOT NULL,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE "staff" (
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
"full_name" TEXT NOT NULL,
"room_id" UUID,
"created_at" TIMESTAMPTZ DEFAULT now() NOT NULL,
PRIMARY KEY ("id")
);
ALTER TABLE "staff" ADD CONSTRAINT "fk_staff_room_id" FOREIGN KEY ("room_id") REFERENCES "rooms" ("id") ON DELETE SET NULL ON UPDATE NO ACTION;
ALTER TABLE "children" ADD CONSTRAINT "fk_children_room_id" FOREIGN KEY ("room_id") REFERENCES "rooms" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE "children" ADD CONSTRAINT "fk_children_key_person_id" FOREIGN KEY ("key_person_id") REFERENCES "staff" ("id") ON DELETE SET NULL ON UPDATE NO ACTION;
ALTER TABLE "child_guardians" ADD CONSTRAINT "fk_child_guardians_child_id" FOREIGN KEY ("child_id") REFERENCES "children" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "child_guardians" ADD CONSTRAINT "fk_child_guardians_guardian_id" FOREIGN KEY ("guardian_id") REFERENCES "guardians" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "child_attendance" ADD CONSTRAINT "fk_child_attendance_child_id" FOREIGN KEY ("child_id") REFERENCES "children" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "incidents" ADD CONSTRAINT "fk_incidents_child_id" FOREIGN KEY ("child_id") REFERENCES "children" ("id") ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE "incidents" ADD CONSTRAINT "fk_incidents_staff_id" FOREIGN KEY ("staff_id") REFERENCES "staff" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION;More Education templates
- Online coursesCourses of modules and lessons, enrolments, lesson progress and quizzes.
- School managementStudents and guardians, classes taught by teachers, grades and attendance.
- University registrarDepartments, courses offered as sections each term, instructors and registrations.
- Quizzes & assessmentsQuizzes of multiple-choice questions, attempts and recorded answers.
- LibraryBooks with authors, physical copies, members, loans and holds.
- Tutoring marketplaceTutors teaching subjects, bookable lessons with students, and reviews.
- CertificationsCertification programmes with exams, candidate attempts and issued certificates.
- Language learningCourses by language, units of lessons and exercises, learner attempts and streaks.
- FlashcardsDecks of cards with spaced-repetition review history per learner.
Start with one diagram, free
One diagram with two branches, no card needed. Upgrade when your team needs more.