Employee training system database schema

Sixteen tables. Subjects carry the design: a process or policy with an owner, a status, how many days people get to complete it, a verification interval and, for policies, the current version. Assignments are stored per person with their own due date, so a role assignment, assign_to_all and a re-signing policy version can each set due dates, and policy versions keep the exact text every signature points to through a two-column foreign key.

  • 16 tables
  • Verified on SQLite 3.53.4 and PostgreSQL 19.0 (PGlite 0.6.1),
  • 78 seed rows from the blueprint
  • The blueprint's test build passed 15 of 15 acceptance checks

Copy the SQLDownload SQLDownload seed data

By Sam Claassen · From the Training Manual blueprint · MIT licensed · Markdown version

Training manual entity-relationship diagram

settingsidPK+ 5 more columnspeopleidPKmanager_id→ people+ 5 more columnsrolesidPK+ 1 more columnperson_rolesperson_idPK → peoplerole_idPK → rolessubjectsidPKowner_id→ peopleverified_by→ people+ 10 more columnsstepsidPKsubject_id→ subjects+ 5 more columnsquestionsidPKsubject_id→ subjects+ 3 more columnsquestion_optionsquestion_idPK → questionspositionPK+ 1 more columnrole_assignmentssubject_idPK → subjectsrole_idPK → rolesperson_assignmentssubject_idPK → subjectsperson_idPK → people+ 2 more columnsstep_readsperson_idPK → peoplestep_idPK → stepsread_atPKquiz_attemptsidPKperson_id→ peoplesubject_id→ subjects+ 4 more columnspolicy_versionssubject_idPK → subjectsversionPK+ 4 more columnssignaturesidPKperson_id→ people+ 4 more columnseventsidPKactor→ people+ 3 more columnsnotificationsidPK+ 7 more columnssettingsidPK+ 5 more columnspeopleidPKmanager_id→ people+ 5 more columnsrolesidPK+ 1 more columnperson_rolesperson_idPK → peoplerole_idPK → rolessubjectsidPKowner_id→ peopleverified_by→ people+ 10 more columnsstepsidPKsubject_id→ subjects+ 5 more columnsquestionsidPKsubject_id→ subjects+ 3 more columnsquestion_optionsquestion_idPK → questionspositionPK+ 1 more columnrole_assignmentssubject_idPK → subjectsrole_idPK → rolesperson_assignmentssubject_idPK → subjectsperson_idPK → people+ 2 more columnsstep_readsperson_idPK → peoplestep_idPK → stepsread_atPKquiz_attemptsidPKperson_id→ peoplesubject_id→ subjects+ 4 more columnspolicy_versionssubject_idPK → subjectsversionPK+ 4 more columnssignaturesidPKperson_id→ people+ 4 more columnseventsidPKactor→ people+ 3 more columnsnotificationsidPK+ 7 more columns
Each box is a table with its key columns. A line runs from a table up to a table it references, with the forked end on the side that has many rows; a dashed line is an optional reference.

Relationships

  • people.manager_id references people.id: each people row points to at most one another people row, and one people row can have many people rows pointing to it.
  • person_roles.person_id references people.id: each person_roles row points to exactly one people row, and one people row can have many person_roles rows pointing to it.
  • person_roles.role_id references roles.id: each person_roles row points to exactly one roles row, and one roles row can have many person_roles rows pointing to it.
  • subjects.owner_id references people.id: each subjects row points to exactly one people row, and one people row can have many subjects rows pointing to it.
  • subjects.verified_by references people.id: each subjects row points to at most one people row, and one people row can have many subjects rows pointing to it.
  • steps.subject_id references subjects.id: each steps row points to exactly one subjects row, and one subjects row can have many steps rows pointing to it.
  • questions.subject_id references subjects.id: each questions row points to exactly one subjects row, and one subjects row can have many questions rows pointing to it.
  • question_options.question_id references questions.id: each question_options row points to exactly one questions row, and one questions row can have many question_options rows pointing to it.
  • role_assignments.subject_id references subjects.id: each role_assignments row points to exactly one subjects row, and one subjects row can have many role_assignments rows pointing to it.
  • role_assignments.role_id references roles.id: each role_assignments row points to exactly one roles row, and one roles row can have many role_assignments rows pointing to it.
  • person_assignments.subject_id references subjects.id: each person_assignments row points to exactly one subjects row, and one subjects row can have many person_assignments rows pointing to it.
  • person_assignments.person_id references people.id: each person_assignments row points to exactly one people row, and one people row can have many person_assignments rows pointing to it.
  • step_reads.person_id references people.id: each step_reads row points to exactly one people row, and one people row can have many step_reads rows pointing to it.
  • step_reads.step_id references steps.id: each step_reads row points to exactly one steps row, and one steps row can have many step_reads rows pointing to it.
  • quiz_attempts.person_id references people.id: each quiz_attempts row points to exactly one people row, and one people row can have many quiz_attempts rows pointing to it.
  • quiz_attempts.subject_id references subjects.id: each quiz_attempts row points to exactly one subjects row, and one subjects row can have many quiz_attempts rows pointing to it.
  • policy_versions.subject_id references subjects.id: each policy_versions row points to exactly one subjects row, and one subjects row can have many policy_versions rows pointing to it.
  • signatures.person_id references people.id: each signatures row points to exactly one people row, and one people row can have many signatures rows pointing to it.
  • signatures.subject_id, version references policy_versions.subject_id, version: each signatures row points to exactly one policy_versions row, and one policy_versions row can have many signatures rows pointing to it.
  • events.actor references people.id: each events row points to at most one people row, and one people row can have many events rows pointing to it.

Training manual tables

The schema has 16 tables. Every column below is read from the SQL file itself. Also described as: training management database design, LMS database tables, policy acknowledgement data model.

TableImplementsWhat a row is
settingsSettingsThe single row with the company name, time zone, due-soon days, verification default and email domain.
peoplePersonSomeone who works at the company, with their manager and start date.
rolesRoleA job role, such as Barista.
person_rolesPersonRoleA role a person holds.
subjectsSubjectA process or policy, with its owner, status, due days, verification and version.
stepsStepOne step of a subject, in order, with soft deletion.
questionsQuestionOne multiple-choice quiz question and the position of its correct option.
question_optionschild table of QuestionOne answer option of a question.
role_assignmentsRoleAssignmentA subject assigned to a role.
person_assignmentsPersonAssignmentA subject assigned to one person, with its due date.
step_readsStepReadA person reading a step, kept as an audit trail.
quiz_attemptsQuizAttemptOne finished quiz attempt with its answers, score and result.
policy_versionsPolicyVersionOne published version of a policy with the text people signed.
signaturesSignatureA person signing one version of a policy.
eventsEventOne line of the append-only activity log.
notificationsNotificationOne email in the outbox, with its send status.

settings

The single settings row for the company.

ColumnTypeNullDefaultKeyNotes
idINTEGERnoPrimary keyone row onlyCheck: id = 1
company_nameTEXTno
time_zoneTEXTnoIANA name; due dates and verification days use it
due_soon_daysINTEGERno2the due-soon reminder goes this many days before due_on (R8)
verification_default_daysINTEGERno180default verify_every_days for new subjects
email_domainTEXTnosign-in and new people must use it

people

Someone who works at the company. An editor is anyone who owns a subject; there is no editor flag.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
nameTEXTnosignatures must match it, ignoring case and extra spaces
emailTEXTnoUniquestored lowercaseCheck: email = LOWER(email)
is_adminBOOLEANnoFALSE
manager_idTEXTyesReferences people.ida manager team is their direct reports only (R8)
start_dateDATEnopeople who start later are due start_date + due_days (R1)
activeBOOLEANnoTRUE
  • Table check: manager_id IS NULL OR manager_id <> id
  • App rule (section 4): the last active admin cannot remove their own admin flag or deactivate themselves; manager chains cannot loop.

roles

A job role, such as Barista.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
nameTEXTnoUnique

person_roles

A role a person holds.

ColumnTypeNullDefaultKeyNotes
person_idTEXTnoPrimary key (part); References people.id
role_idTEXTnoPrimary key (part); References roles.id

subjects

A process or policy people are trained on.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
titleTEXTno
kindTEXTnoCheck: kind IN ('process', 'policy')
owner_idTEXTnoReferences people.id
statusTEXTno'draft'Check: status IN ('draft', 'published', 'archived')
assign_to_allBOOLEANnoFALSEevery active person
open_to_everyoneBOOLEANnoFALSEreadable by all, assigned or not
due_daysINTEGERnodays to complete after assignment
verify_every_daysINTEGERyes
verified_atTIMESTAMPyes
verified_byTEXTyesReferences people.id
versionINTEGERyespolicies only: the current published versionCheck: version >= 1
pass_markINTEGERyespercent, optional; only with a quizCheck: pass_mark BETWEEN 0 AND 100
  • Table check: kind = 'policy' OR version IS NULL
  • App rule (R6): a published subject is due for verification on verified_at + verify_every_days, in the company time zone.
  • App rule (section 4): only admins create subjects and choose the owner.

steps

One step of a subject, in order. A deleted step leaves the reader and the progress count.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
subject_idTEXTnoReferences subjects.id
positionINTEGERno
titleTEXTno
bodyTEXTnoMarkdown
created_atTIMESTAMPnosteps added later count as unread (R5)
deleted_atTIMESTAMPyesreads of a deleted step stay in history under its title

questions

One multiple-choice quiz question of a subject.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
subject_idTEXTnoReferences subjects.id
positionINTEGERno
textTEXTno
correct_optionINTEGERnothe position of the correct optionCheck: correct_option BETWEEN 1 AND 5
  • App rule (section 5): a question has 2 to 5 options.

question_options

One answer option of a question.

ColumnTypeNullDefaultKeyNotes
question_idTEXTnoPrimary key (part); References questions.id
positionINTEGERnoPrimary key (part)Check: position BETWEEN 1 AND 5
textTEXTno

role_assignments

A subject assigned to a role. Everyone with the role gets a person assignment, now and later (R1).

ColumnTypeNullDefaultKeyNotes
subject_idTEXTnoPrimary key (part); References subjects.id
role_idTEXTnoPrimary key (part); References roles.id

person_assignments

A subject assigned to one person, with the date it is due.

ColumnTypeNullDefaultKeyNotes
subject_idTEXTnoPrimary key (part); References subjects.id
person_idTEXTnoPrimary key (part); References people.id
assigned_atTIMESTAMPno
due_onDATEnoa calendar date in the company time zone; overdue from the day after
  • App rule (R1): due_on = assignment date + due_days, or start date + due_days for people who start later; changing due_days leaves existing due dates.
  • App rule (section 7): a re-signing version moves due_on to publish date + due_days for people whose signature counted, if that is later.

step_reads

A person reading a step. Append-only (R9).

ColumnTypeNullDefaultKeyNotes
person_idTEXTnoPrimary key (part); References people.id
step_idTEXTnoPrimary key (part); References steps.id
read_atTIMESTAMPnoPrimary key (part)

quiz_attempts

One finished quiz attempt. Append-only (R9); the best score counts.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
person_idTEXTnoReferences people.id
subject_idTEXTnoReferences subjects.id
atTIMESTAMPno
answersTEXTnothe chosen option position for each question, comma-separated in question order
score_percentINTEGERnocorrect / questions, rounded downCheck: score_percent BETWEEN 0 AND 100
passedBOOLEANnoscore_percent >= pass_mark, or any finished attempt when there is no pass mark

policy_versions

One published version of a policy, with the text people signed.

ColumnTypeNullDefaultKeyNotes
subject_idTEXTnoPrimary key (part); References subjects.id
versionINTEGERnoPrimary key (part)Check: version >= 1
published_atTIMESTAMPno
change_noteTEXTyes
requires_resignBOOLEANnoeveryone assigned must sign again
bodyTEXTnothe full text of the version steps, kept so every signature can show it

signatures

A person signing one version of a policy. Never edited or deleted (R4).

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
person_idTEXTnoReferences people.id
subject_idTEXTno
versionINTEGERno
typed_nameTEXTno
signed_atTIMESTAMPno
  • App rule (section 7): the typed name must match the person name, ignoring case and extra spaces; signing again while a signature counts is refused.

events

One line of the append-only activity log. An export also writes one, with its filters and row count (R10).

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
atTIMESTAMPno
actorTEXTyesReferences people.idNULL for the system
typeTEXTnothe spec gives no fixed list
dataTEXTyesJSON text

notifications

One email in the outbox, listed newest first.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
created_atTIMESTAMPno
kindTEXTnothe spec gives no fixed list
to_emailTEXTno
subjectTEXTno
bodyTEXTno
statusTEXTno'queued'Check: status IN ('queued', 'sent', 'failed', 'logged')
errorTEXTyes

The SQL

The whole schema in one file. It runs top to bottom, unmodified, on SQLite and PostgreSQL. Download training-manual.sql or copy it from here.

training-manual.sql
-- Training Manual database schema
-- Source: https://personalsoftwarefactory.com/blueprints/training-manual (data model, section 5 of the blueprint)
-- Verified on SQLite 3.53.4 and PostgreSQL 19.0 (PGlite). All timestamps are UTC.
-- License: MIT. Free to copy and adapt.

-- The single settings row for the company.
CREATE TABLE settings (
  id INTEGER PRIMARY KEY CHECK (id = 1), -- one row only
  company_name TEXT NOT NULL,
  time_zone TEXT NOT NULL, -- IANA name; due dates and verification days use it
  due_soon_days INTEGER NOT NULL DEFAULT 2, -- the due-soon reminder goes this many days before due_on (R8)
  verification_default_days INTEGER NOT NULL DEFAULT 180, -- default verify_every_days for new subjects
  email_domain TEXT NOT NULL -- sign-in and new people must use it
);

-- Someone who works at the company. An editor is anyone who owns a subject; there is no editor flag.
-- App rule (section 4): the last active admin cannot remove their own admin flag or deactivate themselves; manager chains cannot loop.
CREATE TABLE people (
  id TEXT PRIMARY KEY,
  name TEXT NOT NULL, -- signatures must match it, ignoring case and extra spaces
  email TEXT NOT NULL UNIQUE CHECK (email = LOWER(email)), -- stored lowercase
  is_admin BOOLEAN NOT NULL DEFAULT FALSE,
  manager_id TEXT REFERENCES people(id), -- a manager team is their direct reports only (R8)
  start_date DATE NOT NULL, -- people who start later are due start_date + due_days (R1)
  active BOOLEAN NOT NULL DEFAULT TRUE,
  CHECK (manager_id IS NULL OR manager_id <> id)
);

-- A job role, such as Barista.
CREATE TABLE roles (
  id TEXT PRIMARY KEY,
  name TEXT NOT NULL UNIQUE
);

-- A role a person holds.
CREATE TABLE person_roles (
  person_id TEXT NOT NULL REFERENCES people(id),
  role_id TEXT NOT NULL REFERENCES roles(id),
  PRIMARY KEY (person_id, role_id)
);

-- A process or policy people are trained on.
-- App rule (R6): a published subject is due for verification on verified_at + verify_every_days, in the company time zone.
-- App rule (section 4): only admins create subjects and choose the owner.
CREATE TABLE subjects (
  id TEXT PRIMARY KEY,
  title TEXT NOT NULL,
  kind TEXT NOT NULL CHECK (kind IN ('process', 'policy')),
  owner_id TEXT NOT NULL REFERENCES people(id),
  status TEXT NOT NULL DEFAULT 'draft' CHECK (status IN ('draft', 'published', 'archived')),
  assign_to_all BOOLEAN NOT NULL DEFAULT FALSE, -- every active person
  open_to_everyone BOOLEAN NOT NULL DEFAULT FALSE, -- readable by all, assigned or not
  due_days INTEGER NOT NULL, -- days to complete after assignment
  verify_every_days INTEGER,
  verified_at TIMESTAMP,
  verified_by TEXT REFERENCES people(id),
  version INTEGER CHECK (version >= 1), -- policies only: the current published version
  pass_mark INTEGER CHECK (pass_mark BETWEEN 0 AND 100), -- percent, optional; only with a quiz
  CHECK (kind = 'policy' OR version IS NULL)
);

-- One step of a subject, in order. A deleted step leaves the reader and the progress count.
CREATE TABLE steps (
  id TEXT PRIMARY KEY,
  subject_id TEXT NOT NULL REFERENCES subjects(id),
  position INTEGER NOT NULL,
  title TEXT NOT NULL,
  body TEXT NOT NULL, -- Markdown
  created_at TIMESTAMP NOT NULL, -- steps added later count as unread (R5)
  deleted_at TIMESTAMP -- reads of a deleted step stay in history under its title
);

-- One multiple-choice quiz question of a subject.
-- App rule (section 5): a question has 2 to 5 options.
CREATE TABLE questions (
  id TEXT PRIMARY KEY,
  subject_id TEXT NOT NULL REFERENCES subjects(id),
  position INTEGER NOT NULL,
  text TEXT NOT NULL,
  correct_option INTEGER NOT NULL CHECK (correct_option BETWEEN 1 AND 5) -- the position of the correct option
);

-- One answer option of a question.
CREATE TABLE question_options (
  question_id TEXT NOT NULL REFERENCES questions(id),
  position INTEGER NOT NULL CHECK (position BETWEEN 1 AND 5),
  text TEXT NOT NULL,
  PRIMARY KEY (question_id, position)
);

-- A subject assigned to a role. Everyone with the role gets a person assignment, now and later (R1).
CREATE TABLE role_assignments (
  subject_id TEXT NOT NULL REFERENCES subjects(id),
  role_id TEXT NOT NULL REFERENCES roles(id),
  PRIMARY KEY (subject_id, role_id)
);

-- A subject assigned to one person, with the date it is due.
-- App rule (R1): due_on = assignment date + due_days, or start date + due_days for people who start later; changing due_days leaves existing due dates.
-- App rule (section 7): a re-signing version moves due_on to publish date + due_days for people whose signature counted, if that is later.
CREATE TABLE person_assignments (
  subject_id TEXT NOT NULL REFERENCES subjects(id),
  person_id TEXT NOT NULL REFERENCES people(id),
  assigned_at TIMESTAMP NOT NULL,
  due_on DATE NOT NULL, -- a calendar date in the company time zone; overdue from the day after
  PRIMARY KEY (subject_id, person_id)
);

-- A person reading a step. Append-only (R9).
CREATE TABLE step_reads (
  person_id TEXT NOT NULL REFERENCES people(id),
  step_id TEXT NOT NULL REFERENCES steps(id),
  read_at TIMESTAMP NOT NULL,
  PRIMARY KEY (person_id, step_id, read_at)
);

-- One finished quiz attempt. Append-only (R9); the best score counts.
CREATE TABLE quiz_attempts (
  id TEXT PRIMARY KEY,
  person_id TEXT NOT NULL REFERENCES people(id),
  subject_id TEXT NOT NULL REFERENCES subjects(id),
  at TIMESTAMP NOT NULL,
  answers TEXT NOT NULL, -- the chosen option position for each question, comma-separated in question order
  score_percent INTEGER NOT NULL CHECK (score_percent BETWEEN 0 AND 100), -- correct / questions, rounded down
  passed BOOLEAN NOT NULL -- score_percent >= pass_mark, or any finished attempt when there is no pass mark
);

-- One published version of a policy, with the text people signed.
CREATE TABLE policy_versions (
  subject_id TEXT NOT NULL REFERENCES subjects(id),
  version INTEGER NOT NULL CHECK (version >= 1),
  published_at TIMESTAMP NOT NULL,
  change_note TEXT,
  requires_resign BOOLEAN NOT NULL, -- everyone assigned must sign again
  body TEXT NOT NULL, -- the full text of the version steps, kept so every signature can show it
  PRIMARY KEY (subject_id, version)
);

-- A person signing one version of a policy. Never edited or deleted (R4).
-- App rule (section 7): the typed name must match the person name, ignoring case and extra spaces; signing again while a signature counts is refused.
CREATE TABLE signatures (
  id TEXT PRIMARY KEY,
  person_id TEXT NOT NULL REFERENCES people(id),
  subject_id TEXT NOT NULL,
  version INTEGER NOT NULL,
  typed_name TEXT NOT NULL,
  signed_at TIMESTAMP NOT NULL,
  FOREIGN KEY (subject_id, version) REFERENCES policy_versions(subject_id, version)
);

-- One line of the append-only activity log. An export also writes one, with its filters and row count (R10).
CREATE TABLE events (
  id TEXT PRIMARY KEY,
  at TIMESTAMP NOT NULL,
  actor TEXT REFERENCES people(id), -- NULL for the system
  type TEXT NOT NULL, -- the spec gives no fixed list
  data TEXT -- JSON text
);

-- One email in the outbox, listed newest first.
CREATE TABLE notifications (
  id TEXT PRIMARY KEY,
  created_at TIMESTAMP NOT NULL,
  kind TEXT NOT NULL, -- the spec gives no fixed list
  to_email TEXT NOT NULL,
  subject TEXT NOT NULL,
  body TEXT NOT NULL,
  status TEXT NOT NULL DEFAULT 'queued' CHECK (status IN ('queued', 'sent', 'failed', 'logged')),
  error TEXT
);

Seed data

Loads the settings row, 6 people, 3 roles and 5 role memberships, the 5 published subjects with their 18 steps, the 5-question Espresso basics quiz with its 15 options, 5 role assignments and 15 person assignments. Dates without a time use 12:00 UTC. Placeholders: step body (the spec gives step titles only) and step created_at (2026-01-01); start_date 2026-01-01 for everyone except Eli Moss; assigned_at 2026-09-01 for the Opening checklist (Cara, Dev, Ben), Cash handling (Ben) and Roasting safety (Fay), with due_on following R1 from it, except Cash handling, which version 3 (published Oct 14 with requires_resign) moves to Oct 21. verified_at is left empty for Espresso basics, Food safety and Cash handling, which the spec says only were verified within the last 60 days; verify_every_days is the 180-day default where no interval is given; verified_by is empty. Left out: step reads, quiz attempts and signatures, because the spec gives no read, attempt or signing times, does not say which 2 steps Eli read or which questions Cara and Dev missed; policy versions, because 4 of 5 publish dates, every version text and whether Food safety version 2 required re-signing are not given; and events and notifications, which the spec does not seed. Without them, progress statuses from section 6 cannot be computed on this seed.

Download training-manual-seed.sql (78 rows). It loads with foreign keys enforced on both engines.

Load it

SQLite, into a new file:

sqlite3
curl -s https://personalsoftwarefactory.com/schemas/training-manual.sql https://personalsoftwarefactory.com/schemas/training-manual-seed.sql | sqlite3 training_manual.db

PostgreSQL, into a new database:

psql
createdb training_manual && curl -s https://personalsoftwarefactory.com/schemas/training-manual.sql https://personalsoftwarefactory.com/schemas/training-manual-seed.sql | psql -v ON_ERROR_STOP=1 training_manual

SQLite only enforces foreign keys when the connection asks for it: run PRAGMA foreign_keys = ON; when your app opens the database.

Design decisions

Assignments are stored per person, with their own due date

R1 assigns a role subject to everyone with the role, now and later, and keeps existing assignments when a role assignment is removed. So role_assignments records the rule and person_assignments the result, one row per subject and person with assigned_at and due_on. Section 7 can move one person's due date when a re-signing version is published, which a computed due date could not do.

Signatures point at the exact policy version

Section 7 says every signature shows the exact text of the version signed. policy_versions keeps each published version's full text, keyed by subject and version, and signatures has a two-column foreign key to it, so a signature can never name a version that was not published. Signatures, step reads and quiz attempts are append-only (R9).

Quiz options are a child table, the answer is a position

Section 5 gives each question 2 to 5 options and a correct option. Options are a child table keyed by question and position (1 to 5), and correct_option stores the position, so renaming an option does not break the answer key. The 2-option minimum counts rows, so it is an app rule.

Version only on policies

Section 5 gives subjects a version for policies. A CHECK keeps version empty on processes and at least 1 on policies that have one; publishing a policy for the first time makes it version 1 (section 7). pass_mark is an optional percent from 0 to 100.

Steps are soft-deleted

Section 5 says a deleted step leaves the reader and the progress count, but its reads stay in history under its title. deleted_at marks it instead of removing the row, so step_reads keeps a valid foreign key and the training record stays an audit trail. created_at lets the app count steps added later as unread (R5).

Progress is computed, not stored

Section 6 derives a status (Completed, Overdue, Needs signature, In progress, Not started) and a percent from reads, attempts and signatures, the same way everywhere (R2). There is no status column on person_assignments, because a re-signing version or a new step changes it without anyone touching the assignment.

Example queries

The queries behind the tool's main screens. Each returned the same rows on both engines against the seed data.

Subjects due for verification on Oct 15 (180-day interval)

SQL
SELECT s.title, o.name AS owner, s.verified_at FROM subjects s JOIN people o ON o.id = s.owner_id WHERE s.status = 'published' AND s.verify_every_days = 180 AND s.verified_at < '2026-04-19 04:00:00' ORDER BY s.verified_at;

On the seed data: 1 row, Opening checklist (owner Ben Ortiz, verified 2026-04-10).

Quiz answer key, shown after a pass

SQL
SELECT q.position, q.text AS question, o.text AS correct_answer FROM questions q JOIN question_options o ON o.question_id = q.id AND o.position = q.correct_option WHERE q.subject_id = 's_espresso' ORDER BY q.position;

On the seed data: 5 rows, from 18 g to Before and after every jug.

One person's assignments with due dates

SQL
SELECT s.title, s.kind, pa.assigned_at, pa.due_on FROM person_assignments pa JOIN subjects s ON s.id = pa.subject_id WHERE pa.person_id = 'p_eli' ORDER BY pa.due_on, s.title;

On the seed data: 3 rows for Eli Moss, Opening checklist due 2026-10-19 first.

People assigned to each subject

SQL
SELECT s.title, s.kind, COUNT(pa.person_id) AS assigned FROM subjects s LEFT JOIN person_assignments pa ON pa.subject_id = s.id WHERE s.status = 'published' GROUP BY s.title, s.kind ORDER BY s.title;

On the seed data: 5 rows; Food safety policy has 6 (assign_to_all).

What was not tested

  • MySQL, MariaDB, SQL Server and Oracle. The file avoids engine-specific syntax, but it was not run on them.
  • Other versions of SQLite and PostgreSQL than the two named above.
  • PostgreSQL as a server. The PostgreSQL run used PGlite, which is PostgreSQL compiled to run in-process.
  • Production load. The check loads the seed rows and runs the example queries; it says nothing about performance with real volumes.
  • Migrations. This is a schema for a new database, not a path from an existing one.

The blueprint this schema comes from

Tables are the easy half. This schema is section 5 of the Training Manual blueprint, a free spec that also has the business rules, the screens, 4 phased build prompts and 15 acceptance checks for building the whole tool with an AI app builder. We built it from those prompts and the result passed 15 of 15 acceptance checks in a browser.

Follow new blueprints

Every new blueprint and build test appears in the feed and in the public GitHub repository. No account, no email list.