Applicant tracking system database schema

Thirteen tables. Applications carry the design: one row per candidate per role, with a stage from a fixed list, the stage it closed from, a reject reason that exists only while rejected, consent from the careers form and a private withdraw token. Interviews hold one scorecard per interviewer, and ratings sit in their own table keyed by scorecard and role attribute, so the app can show feedback without ever turning it into a score.

  • 13 tables, 4 indexes
  • Verified on SQLite 3.53.4 and PostgreSQL 19.0 (PGlite 0.6.1),
  • 56 seed rows from the blueprint
  • The blueprint's test build passed 29 of 29 acceptance checks

Copy the SQLDownload SQLDownload seed data

By Sam Claassen · From the Hiring Pipeline blueprint · MIT licensed · Markdown version

Hiring pipeline entity-relationship diagram

peopleidPK+ 4 more columnssettingsidPK+ 8 more columnsrolesidPKhiring_manager_id→ people+ 7 more columnsrole_attributesidPKrole_id→ roles+ 2 more columnscandidatesidPK+ 5 more columnsapplicationsidPKcandidate_id→ candidatesrole_id→ roles+ 14 more columnsinterviewsidPKapplication_id→ applicationscreated_by→ people+ 6 more columnsscorecardsidPKinterview_id→ interviewsinterviewer_id→ people+ 5 more columnsattribute_ratingsscorecard_idPK → scorecardsattribute_idPK → role_attribut…+ 1 more columnnotesidPKapplication_id→ applicationsauthor_id→ people+ 2 more columnseventsidPKapplication_id→ applicationsactor_id→ people+ 3 more columnsnotificationsidPKperson_id→ peopleapplication_id→ applications+ 9 more columnsapply_attemptsidPK+ 2 more columnspeopleidPK+ 4 more columnssettingsidPK+ 8 more columnsrolesidPKhiring_manager_id→ people+ 7 more columnsrole_attributesidPKrole_id→ roles+ 2 more columnscandidatesidPK+ 5 more columnsapplicationsidPKcandidate_id→ candidatesrole_id→ roles+ 14 more columnsinterviewsidPKapplication_id→ applicationscreated_by→ people+ 6 more columnsscorecardsidPKinterview_id→ interviewsinterviewer_id→ people+ 5 more columnsattribute_ratingsscorecard_idPK → scorecardsattribute_idPK → role_attribut…+ 1 more columnnotesidPKapplication_id→ applicationsauthor_id→ people+ 2 more columnseventsidPKapplication_id→ applicationsactor_id→ people+ 3 more columnsnotificationsidPKperson_id→ peopleapplication_id→ applications+ 9 more columnsapply_attemptsidPK+ 2 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

  • roles.hiring_manager_id references people.id: each roles row points to at most one people row, and one people row can have many roles rows pointing to it.
  • role_attributes.role_id references roles.id: each role_attributes row points to exactly one roles row, and one roles row can have many role_attributes rows pointing to it.
  • applications.candidate_id references candidates.id: each applications row points to exactly one candidates row, and one candidates row can have many applications rows pointing to it.
  • applications.role_id references roles.id: each applications row points to exactly one roles row, and one roles row can have many applications rows pointing to it.
  • interviews.application_id references applications.id: each interviews row points to exactly one applications row, and one applications row can have many interviews rows pointing to it.
  • interviews.created_by references people.id: each interviews row points to at most one people row, and one people row can have many interviews rows pointing to it.
  • scorecards.interview_id references interviews.id: each scorecards row points to exactly one interviews row, and one interviews row can have many scorecards rows pointing to it.
  • scorecards.interviewer_id references people.id: each scorecards row points to exactly one people row, and one people row can have many scorecards rows pointing to it.
  • attribute_ratings.scorecard_id references scorecards.id: each attribute_ratings row points to exactly one scorecards row, and one scorecards row can have many attribute_ratings rows pointing to it.
  • attribute_ratings.attribute_id references role_attributes.id: each attribute_ratings row points to exactly one role_attributes row, and one role_attributes row can have many attribute_ratings rows pointing to it.
  • notes.application_id references applications.id: each notes row points to exactly one applications row, and one applications row can have many notes rows pointing to it.
  • notes.author_id references people.id: each notes row points to exactly one people row, and one people row can have many notes rows pointing to it.
  • events.application_id references applications.id: each events row points to at most one applications row, and one applications row can have many events rows pointing to it.
  • events.actor_id 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.
  • notifications.person_id references people.id: each notifications row points to at most one people row, and one people row can have many notifications rows pointing to it.
  • notifications.application_id references applications.id: each notifications row points to at most one applications row, and one applications row can have many notifications rows pointing to it.

Hiring pipeline tables

The schema has 13 tables. Every column below is read from the SQL file itself. Also described as: recruitment database design, hiring pipeline database tables, ATS data model.

TableImplementsWhat a row is
peoplePersonA member of the hiring team who can sign in.
settingsSettingsThe single row with the company name, privacy notice and version, retention days and rejection template.
rolesRoleA job with its hiring manager, location, description and status.
role_attributesRoleAttributeOne scorecard criterion of a role, in display order.
candidatesCandidateA person who applied or was added, matched by email.
applicationsApplicationOne candidate for one role, with its stage, source, consent and close details.
interviewsInterviewA scheduled screen or interview on an application.
scorecardsScorecardOne interviewer feedback form for one interview.
attribute_ratingsAttributeRatingOne 1 to 4 rating, or Not assessed, for one attribute on a scorecard.
notesNoteAn internal comment on an application, hidden from interviewers.
eventsEventOne line of the append-only activity log, with no candidate personal data.
notificationsNotificationOne email in the outbox, with its send status and attempts.
apply_attemptsApplyAttemptOne accepted careers-form submission, keyed by a hash of the IP, for the rate limit.

people

A member of the hiring team who can sign in. People are deactivated, never deleted.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
nameTEXTnoCheck: LENGTH(name) >= 1
emailTEXTnoUniquestored lowercaseCheck: email = LOWER(email)
is_adminBOOLEANnoFALSE
activeBOOLEANnoTRUE
  • App rule (R17): deactivating a hiring manager of an open or paused role, or someone with pending scorecards, is refused; at least one active admin remains.

settings

The single settings row for the company.

ColumnTypeNullDefaultKeyNotes
idINTEGERnoPrimary keyone row onlyCheck: id = 1
company_nameTEXTnoCheck: LENGTH(company_name) BETWEEN 1 AND 60
time_zoneTEXTno'America/New_York'IANA name; dates and the 08:00 digest use it
careers_introTEXTyesoptional, top of the careers pageCheck: LENGTH(careers_intro) <= 1000
privacy_noticeTEXTnothe text candidates acceptCheck: LENGTH(privacy_notice) BETWEEN 1 AND 2000
privacy_versionINTEGERno1Check: privacy_version >= 1
retention_daysINTEGERno180Check: retention_days BETWEEN 30 AND 730
rejection_templateTEXTnomay use {candidate_first_name}, {role_title}, {company_name}Check: LENGTH(rejection_template) BETWEEN 1 AND 2000
last_digest_atTIMESTAMPyeswritten only by the scheduled job
  • App rule (R15): changing privacy_notice adds 1 to privacy_version and writes a settings_changed event.

roles

A job the team is hiring for.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
titleTEXTnoCheck: LENGTH(title) BETWEEN 1 AND 100
departmentTEXTyesoptionalCheck: LENGTH(department) <= 60
locationTEXTnofor example Remote (US)Check: LENGTH(location) BETWEEN 1 AND 80
descriptionTEXTnoMarkdownCheck: LENGTH(description) BETWEEN 20 AND 5000
hiring_manager_idTEXTyesReferences people.idmust be an active person; required to open the role
statusTEXTno'paused'Check: status IN ('open', 'paused', 'closed')
opened_atTIMESTAMPyesempty until the role is first opened
closed_atTIMESTAMPyes
  • Table check: status <> 'open' OR (hiring_manager_id IS NOT NULL AND opened_at IS NOT NULL)
  • Unique index roles_title_uniq on (LOWER(title)) where status <> 'closed'
  • App rule (R4): a role needs 3 to 6 attributes to be opened; closing a role rejects its open applications in the same action.

role_attributes

One scorecard criterion of a role.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
role_idTEXTnoReferences roles.id
nameTEXTnoCheck: LENGTH(name) BETWEEN 2 AND 60
positionINTEGERnodisplay order on the scorecard
  • Unique index role_attributes_name_uniq on (role_id, LOWER(name))
  • App rule (section 5): an attribute that has ratings can be renamed or reordered but not removed.

candidates

A person who applied or was added by the team.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
nameTEXTnoCheck: LENGTH(name) BETWEEN 1 AND 100
emailTEXTyesstored lowercase; cleared only by anonymizationCheck: LENGTH(email) <= 254 AND email = LOWER(email)
phoneTEXTyesCheck: LENGTH(phone) <= 30
linkTEXTyesCV, LinkedIn or portfolioCheck: LENGTH(link) <= 2000 AND link LIKE 'https://%'
anonymized_atTIMESTAMPyes
  • Table check: anonymized_at IS NOT NULL OR email IS NOT NULL
  • Unique index candidates_email_uniq on (email) where anonymized_at IS NULL
  • App rule (R14): when no application is open, hired or inside the retention window, name becomes Anonymized candidate and email, phone and link are cleared.

applications

One candidate for one role, moving through the stages.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
candidate_idTEXTnoReferences candidates.id
role_idTEXTnoReferences roles.id
sourceTEXTnoCheck: source IN ('careers_page', 'referral', 'sourced', 'agency', 'other')
source_detailTEXTyesfor example the referrer nameCheck: LENGTH(source_detail) <= 100
answerTEXTyesWhy this role? Required on the careers form, optional when the team adds a candidateCheck: LENGTH(answer) BETWEEN 1 AND 2000
consent_atTIMESTAMPyesfrom the privacy checkbox; NULL when the team added the candidate
consent_versionINTEGERyesthe privacy_version accepted
stageTEXTno'applied'Check: stage IN ('applied', 'screen', 'interview', 'offer', 'hired', 'rejected', 'withdrawn')
stage_before_closeTEXTyesthe stage when rejected or withdrawnCheck: stage_before_close IN ('applied', 'screen', 'interview', 'offer')
reject_reasonTEXTyesCheck: reject_reason IN ('requirements', 'chose_another', 'role_closed', 'no_response', 'other')
close_noteTEXTyesCheck: LENGTH(close_note) <= 500
applied_atTIMESTAMPno
stage_changed_atTIMESTAMPno
closed_atTIMESTAMPyesset by hire, reject and withdraw
withdraw_tokenTEXTnoUniqueat least 128 random bits, URL-safe (R13)
anonymized_atTIMESTAMPyes
  • Unique together: candidate_id, role_id
  • Table check: (consent_at IS NULL AND consent_version IS NULL) OR (consent_at IS NOT NULL AND consent_version IS NOT NULL)
  • Table check: (stage IN ('hired', 'rejected', 'withdrawn') AND closed_at IS NOT NULL) OR (stage IN ('applied', 'screen', 'interview', 'offer') AND closed_at IS NULL)
  • Table check: stage NOT IN ('rejected', 'withdrawn') OR stage_before_close IS NOT NULL
  • Table check: (stage = 'rejected' AND reject_reason IS NOT NULL) OR (stage <> 'rejected' AND reject_reason IS NULL)
  • App rule (R6): advance and move back change the stage by exactly one step.
  • App rule (R7): Interview to Offer needs a submitted scorecard and no pending ones on interviews that are not cancelled.
  • App rule (R14): anonymization clears answer and close_note.

interviews

A scheduled screen or interview on an application.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
application_idTEXTnoReferences applications.id
kindTEXTnoCheck: kind IN ('screen', 'interview')
starts_atTIMESTAMPno
duration_minutesINTEGERyesCheck: duration_minutes BETWEEN 15 AND 240
locationTEXTyesa room, a phone number or a video link; required when schedulingCheck: LENGTH(location) <= 200
created_byTEXTyesReferences people.idwho scheduled it
created_atTIMESTAMPno
cancelled_atTIMESTAMPyes
  • App rule (section 7): 1 to 4 active interviewers, one pending scorecard each.
  • App rule (R14): anonymization clears location.

scorecards

One interviewer feedback form for one interview.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
interview_idTEXTnoReferences interviews.id
interviewer_idTEXTnoReferences people.id
statusTEXTno'pending'Check: status IN ('pending', 'submitted', 'cancelled')
takeawaysTEXTyesCheck: LENGTH(takeaways) BETWEEN 20 AND 3000
recommendationTEXTyesno default; no_decision is an explicit choiceCheck: recommendation IN ('definitely_not', 'no', 'yes', 'strong_yes', 'no_decision')
submitted_atTIMESTAMPyes
reminded_atTIMESTAMPyesset by the job 24 hours after the interview started
  • Unique together: interview_id, interviewer_id
  • Table check: (status = 'submitted' AND recommendation IS NOT NULL AND submitted_at IS NOT NULL) OR (status <> 'submitted' AND submitted_at IS NULL)
  • App rule (R10): only the assigned interviewer submits, once, after starts_at, with at least one rating and takeaways of 20 or more characters.
  • App rule (R14): anonymization deletes takeaways.

attribute_ratings

One attribute rating on a scorecard.

ColumnTypeNullDefaultKeyNotes
scorecard_idTEXTnoPrimary key (part); References scorecards.id
attribute_idTEXTnoPrimary key (part); References role_attributes.id
ratingINTEGERyesNULL means Not assessed; 1 Weak, 2 Mixed, 3 Good, 4 StrongCheck: rating BETWEEN 1 AND 4

notes

An internal comment on an application. Admins and the hiring manager only (R12).

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
application_idTEXTnoReferences applications.id
author_idTEXTnoReferences people.id
textTEXTnoCheck: LENGTH(text) BETWEEN 1 AND 2000
created_atTIMESTAMPno

events

One line of the activity log. Never holds candidate personal data.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
application_idTEXTyesReferences applications.idNULL for candidate_deleted, role and settings events
actor_idTEXTyesReferences people.idNULL for the candidate and the system
typeTEXTnoCheck: type IN ('applied', 'added', 'stage_changed', 'rejected', 'withdrawn', 'reopened', 'hired', 'interview_scheduled', 'interview_cancelled', 'scorecard_submitted', 'note_added', 'anonymized', 'candidate_deleted', 'role_created', 'role_changed', 'settings_changed')
dataTEXTyesJSON text: from/to stage, reason, counts
created_atTIMESTAMPno
  • App rule (R18): events are never edited, and only removed by Delete now (R16).

notifications

One email in the outbox, written before it is sent.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
kindTEXTnothe trigger from section 10; the spec gives no fixed list of values
to_emailTEXTno
person_idTEXTyesReferences people.idNULL for candidates
application_idTEXTyesReferences applications.id
subjectTEXTno
bodyTEXTnoplain text
statusTEXTno'pending'Check: status IN ('pending', 'sent', 'logged', 'failed')
errorTEXTyes
attemptsINTEGERno0each send attempt adds 1; retries stop at 5Check: attempts >= 0
created_atTIMESTAMPno
sent_atTIMESTAMPyes

apply_attempts

One accepted careers-form submission, for the rate limit (R5). Rows older than a day are deleted.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary keyrow id; the spec lists only ip_hash and created_at
ip_hashTEXTnoHMAC of the IP address with a server secret; the IP itself is never stored
created_atTIMESTAMPno
  • Index apply_attempts_ip_idx on (ip_hash, created_at)

The SQL

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

hiring-pipeline.sql
-- Hiring Pipeline database schema
-- Source: https://personalsoftwarefactory.com/blueprints/hiring-pipeline (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.

-- A member of the hiring team who can sign in. People are deactivated, never deleted.
-- App rule (R17): deactivating a hiring manager of an open or paused role, or someone with pending scorecards, is refused; at least one active admin remains.
CREATE TABLE people (
  id TEXT PRIMARY KEY,
  name TEXT NOT NULL CHECK (LENGTH(name) >= 1),
  email TEXT NOT NULL UNIQUE CHECK (email = LOWER(email)), -- stored lowercase
  is_admin BOOLEAN NOT NULL DEFAULT FALSE,
  active BOOLEAN NOT NULL DEFAULT TRUE
);

-- The single settings row for the company.
-- App rule (R15): changing privacy_notice adds 1 to privacy_version and writes a settings_changed event.
CREATE TABLE settings (
  id INTEGER PRIMARY KEY CHECK (id = 1), -- one row only
  company_name TEXT NOT NULL CHECK (LENGTH(company_name) BETWEEN 1 AND 60),
  time_zone TEXT NOT NULL DEFAULT 'America/New_York', -- IANA name; dates and the 08:00 digest use it
  careers_intro TEXT CHECK (LENGTH(careers_intro) <= 1000), -- optional, top of the careers page
  privacy_notice TEXT NOT NULL CHECK (LENGTH(privacy_notice) BETWEEN 1 AND 2000), -- the text candidates accept
  privacy_version INTEGER NOT NULL DEFAULT 1 CHECK (privacy_version >= 1),
  retention_days INTEGER NOT NULL DEFAULT 180 CHECK (retention_days BETWEEN 30 AND 730),
  rejection_template TEXT NOT NULL CHECK (LENGTH(rejection_template) BETWEEN 1 AND 2000), -- may use {candidate_first_name}, {role_title}, {company_name}
  last_digest_at TIMESTAMP -- written only by the scheduled job
);

-- A job the team is hiring for.
-- App rule (R4): a role needs 3 to 6 attributes to be opened; closing a role rejects its open applications in the same action.
CREATE TABLE roles (
  id TEXT PRIMARY KEY,
  title TEXT NOT NULL CHECK (LENGTH(title) BETWEEN 1 AND 100),
  department TEXT CHECK (LENGTH(department) <= 60), -- optional
  location TEXT NOT NULL CHECK (LENGTH(location) BETWEEN 1 AND 80), -- for example Remote (US)
  description TEXT NOT NULL CHECK (LENGTH(description) BETWEEN 20 AND 5000), -- Markdown
  hiring_manager_id TEXT REFERENCES people(id), -- must be an active person; required to open the role
  status TEXT NOT NULL DEFAULT 'paused' CHECK (status IN ('open', 'paused', 'closed')),
  opened_at TIMESTAMP, -- empty until the role is first opened
  closed_at TIMESTAMP,
  CHECK (status <> 'open' OR (hiring_manager_id IS NOT NULL AND opened_at IS NOT NULL))
);
CREATE UNIQUE INDEX roles_title_uniq ON roles (LOWER(title)) WHERE status <> 'closed'; -- unique ignoring case among roles that are not closed

-- One scorecard criterion of a role.
-- App rule (section 5): an attribute that has ratings can be renamed or reordered but not removed.
CREATE TABLE role_attributes (
  id TEXT PRIMARY KEY,
  role_id TEXT NOT NULL REFERENCES roles(id),
  name TEXT NOT NULL CHECK (LENGTH(name) BETWEEN 2 AND 60),
  position INTEGER NOT NULL -- display order on the scorecard
);
CREATE UNIQUE INDEX role_attributes_name_uniq ON role_attributes (role_id, LOWER(name)); -- unique per role ignoring case

-- A person who applied or was added by the team.
-- App rule (R14): when no application is open, hired or inside the retention window, name becomes Anonymized candidate and email, phone and link are cleared.
CREATE TABLE candidates (
  id TEXT PRIMARY KEY,
  name TEXT NOT NULL CHECK (LENGTH(name) BETWEEN 1 AND 100),
  email TEXT CHECK (LENGTH(email) <= 254 AND email = LOWER(email)), -- stored lowercase; cleared only by anonymization
  phone TEXT CHECK (LENGTH(phone) <= 30),
  link TEXT CHECK (LENGTH(link) <= 2000 AND link LIKE 'https://%'), -- CV, LinkedIn or portfolio
  anonymized_at TIMESTAMP,
  CHECK (anonymized_at IS NOT NULL OR email IS NOT NULL)
);
CREATE UNIQUE INDEX candidates_email_uniq ON candidates (email) WHERE anonymized_at IS NULL; -- unique among candidates that are not anonymized

-- One candidate for one role, moving through the stages.
-- App rule (R6): advance and move back change the stage by exactly one step.
-- App rule (R7): Interview to Offer needs a submitted scorecard and no pending ones on interviews that are not cancelled.
-- App rule (R14): anonymization clears answer and close_note.
CREATE TABLE applications (
  id TEXT PRIMARY KEY,
  candidate_id TEXT NOT NULL REFERENCES candidates(id),
  role_id TEXT NOT NULL REFERENCES roles(id),
  source TEXT NOT NULL CHECK (source IN ('careers_page', 'referral', 'sourced', 'agency', 'other')),
  source_detail TEXT CHECK (LENGTH(source_detail) <= 100), -- for example the referrer name
  answer TEXT CHECK (LENGTH(answer) BETWEEN 1 AND 2000), -- Why this role? Required on the careers form, optional when the team adds a candidate
  consent_at TIMESTAMP, -- from the privacy checkbox; NULL when the team added the candidate
  consent_version INTEGER, -- the privacy_version accepted
  stage TEXT NOT NULL DEFAULT 'applied' CHECK (stage IN ('applied', 'screen', 'interview', 'offer', 'hired', 'rejected', 'withdrawn')),
  stage_before_close TEXT CHECK (stage_before_close IN ('applied', 'screen', 'interview', 'offer')), -- the stage when rejected or withdrawn
  reject_reason TEXT CHECK (reject_reason IN ('requirements', 'chose_another', 'role_closed', 'no_response', 'other')),
  close_note TEXT CHECK (LENGTH(close_note) <= 500),
  applied_at TIMESTAMP NOT NULL,
  stage_changed_at TIMESTAMP NOT NULL,
  closed_at TIMESTAMP, -- set by hire, reject and withdraw
  withdraw_token TEXT NOT NULL UNIQUE, -- at least 128 random bits, URL-safe (R13)
  anonymized_at TIMESTAMP,
  UNIQUE (candidate_id, role_id),
  CHECK ((consent_at IS NULL AND consent_version IS NULL) OR (consent_at IS NOT NULL AND consent_version IS NOT NULL)),
  CHECK ((stage IN ('hired', 'rejected', 'withdrawn') AND closed_at IS NOT NULL) OR (stage IN ('applied', 'screen', 'interview', 'offer') AND closed_at IS NULL)),
  CHECK (stage NOT IN ('rejected', 'withdrawn') OR stage_before_close IS NOT NULL),
  CHECK ((stage = 'rejected' AND reject_reason IS NOT NULL) OR (stage <> 'rejected' AND reject_reason IS NULL))
);

-- A scheduled screen or interview on an application.
-- App rule (section 7): 1 to 4 active interviewers, one pending scorecard each.
-- App rule (R14): anonymization clears location.
CREATE TABLE interviews (
  id TEXT PRIMARY KEY,
  application_id TEXT NOT NULL REFERENCES applications(id),
  kind TEXT NOT NULL CHECK (kind IN ('screen', 'interview')),
  starts_at TIMESTAMP NOT NULL,
  duration_minutes INTEGER CHECK (duration_minutes BETWEEN 15 AND 240),
  location TEXT CHECK (LENGTH(location) <= 200), -- a room, a phone number or a video link; required when scheduling
  created_by TEXT REFERENCES people(id), -- who scheduled it
  created_at TIMESTAMP NOT NULL,
  cancelled_at TIMESTAMP
);

-- One interviewer feedback form for one interview.
-- App rule (R10): only the assigned interviewer submits, once, after starts_at, with at least one rating and takeaways of 20 or more characters.
-- App rule (R14): anonymization deletes takeaways.
CREATE TABLE scorecards (
  id TEXT PRIMARY KEY,
  interview_id TEXT NOT NULL REFERENCES interviews(id),
  interviewer_id TEXT NOT NULL REFERENCES people(id),
  status TEXT NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'submitted', 'cancelled')),
  takeaways TEXT CHECK (LENGTH(takeaways) BETWEEN 20 AND 3000),
  recommendation TEXT CHECK (recommendation IN ('definitely_not', 'no', 'yes', 'strong_yes', 'no_decision')), -- no default; no_decision is an explicit choice
  submitted_at TIMESTAMP,
  reminded_at TIMESTAMP, -- set by the job 24 hours after the interview started
  UNIQUE (interview_id, interviewer_id),
  CHECK ((status = 'submitted' AND recommendation IS NOT NULL AND submitted_at IS NOT NULL) OR (status <> 'submitted' AND submitted_at IS NULL))
);

-- One attribute rating on a scorecard.
CREATE TABLE attribute_ratings (
  scorecard_id TEXT NOT NULL REFERENCES scorecards(id),
  attribute_id TEXT NOT NULL REFERENCES role_attributes(id),
  rating INTEGER CHECK (rating BETWEEN 1 AND 4), -- NULL means Not assessed; 1 Weak, 2 Mixed, 3 Good, 4 Strong
  PRIMARY KEY (scorecard_id, attribute_id)
);

-- An internal comment on an application. Admins and the hiring manager only (R12).
CREATE TABLE notes (
  id TEXT PRIMARY KEY,
  application_id TEXT NOT NULL REFERENCES applications(id),
  author_id TEXT NOT NULL REFERENCES people(id),
  text TEXT NOT NULL CHECK (LENGTH(text) BETWEEN 1 AND 2000),
  created_at TIMESTAMP NOT NULL
);

-- One line of the activity log. Never holds candidate personal data.
-- App rule (R18): events are never edited, and only removed by Delete now (R16).
CREATE TABLE events (
  id TEXT PRIMARY KEY,
  application_id TEXT REFERENCES applications(id), -- NULL for candidate_deleted, role and settings events
  actor_id TEXT REFERENCES people(id), -- NULL for the candidate and the system
  type TEXT NOT NULL CHECK (type IN ('applied', 'added', 'stage_changed', 'rejected', 'withdrawn', 'reopened', 'hired', 'interview_scheduled', 'interview_cancelled', 'scorecard_submitted', 'note_added', 'anonymized', 'candidate_deleted', 'role_created', 'role_changed', 'settings_changed')),
  data TEXT, -- JSON text: from/to stage, reason, counts
  created_at TIMESTAMP NOT NULL
);

-- One email in the outbox, written before it is sent.
CREATE TABLE notifications (
  id TEXT PRIMARY KEY,
  kind TEXT NOT NULL, -- the trigger from section 10; the spec gives no fixed list of values
  to_email TEXT NOT NULL,
  person_id TEXT REFERENCES people(id), -- NULL for candidates
  application_id TEXT REFERENCES applications(id),
  subject TEXT NOT NULL,
  body TEXT NOT NULL, -- plain text
  status TEXT NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'sent', 'logged', 'failed')),
  error TEXT,
  attempts INTEGER NOT NULL DEFAULT 0 CHECK (attempts >= 0), -- each send attempt adds 1; retries stop at 5
  created_at TIMESTAMP NOT NULL,
  sent_at TIMESTAMP
);

-- One accepted careers-form submission, for the rate limit (R5). Rows older than a day are deleted.
CREATE TABLE apply_attempts (
  id TEXT PRIMARY KEY, -- row id; the spec lists only ip_hash and created_at
  ip_hash TEXT NOT NULL, -- HMAC of the IP address with a server secret; the IP itself is never stored
  created_at TIMESTAMP NOT NULL
);
CREATE INDEX apply_attempts_ip_idx ON apply_attempts (ip_hash, created_at);

Seed data

Loads the settings row, 7 people, 3 open roles with their 11 attributes, 9 candidates and 9 applications, 4 interviews, 7 scorecards (2 pending, 5 submitted), Ben Cho's 4 ratings on Sora Ito and Maya's note on Mei Chen, with T fixed at Tue 13 Oct 2026, EDT times converted to UTC and dates without a time set to 12:00 UTC. Placeholders (one fixed value per field, saying the spec leaves it to the builder): the privacy notice, role descriptions, the answer on the 4 careers-page applications, interview locations and the takeaways on the 4 submitted scorecards other than Ben Cho on Sora Ito; team emails (the spec gives none) and withdraw tokens (not random; generate real ones). Placeholder dates, which no worked example depends on: role opened_at (the date of the earliest seeded application for the role), stage_changed_at for Leo, Sora and Ari (their applied date) and Taylor (after the T-8 scorecards), interview created_at (the applied date), scorecard submitted_at (23:00 UTC on the interview day) and the note created_at (the applied date). Left empty because the spec does not give them: interview duration and created_by, and ratings on the 4 submitted scorecards other than Ben Cho on Sora Ito. Events are not seeded, because the spec does not seed them; no notifications or apply attempts either.

Download hiring-pipeline-seed.sql (56 rows). It loads with foreign keys enforced on both engines.

Load it

SQLite, into a new file:

sqlite3
curl -s https://personalsoftwarefactory.com/schemas/hiring-pipeline.sql https://personalsoftwarefactory.com/schemas/hiring-pipeline-seed.sql | sqlite3 hiring_pipeline.db

PostgreSQL, into a new database:

psql
createdb hiring_pipeline && curl -s https://personalsoftwarefactory.com/schemas/hiring-pipeline.sql https://personalsoftwarefactory.com/schemas/hiring-pipeline-seed.sql | psql -v ON_ERROR_STOP=1 hiring_pipeline

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

Design decisions

One application per candidate per role

Section 5 and R3 allow one application per candidate per role, so applications has UNIQUE (candidate_id, role_id); applying again creates nothing. Candidates are matched by lowercased email, unique among candidates that are not anonymized, which is a partial unique index so anonymized rows with a cleared email never collide.

The stage decides which close fields are set

Section 6 sets closed_at on hire, reject and withdraw and clears it on reopen, and Reject requires a reason that Reopen clears. Table checks make closed_at present exactly in the three final stages, the reject reason present exactly while rejected, and stage_before_close present for rejected and withdrawn. Moving one stage at a time (R6) and the Offer gate (R7) are cross-row rules left to the app.

Ratings are their own table, and no score is stored

From the build test · field report

Each scorecard rates the role's 3 to 6 attributes 1 to 4 or Not assessed, so attribute_ratings is keyed by scorecard and attribute with a nullable rating (NULL means Not assessed). Section 7 says the app never combines ratings into a score, so there is no total or average column. An attribute that has ratings can be renamed but not removed, which the build test found was unspecified.

Anonymization clears fields, so some required fields are nullable

From the build test · field report

R14 clears a candidate's email, phone and link, an application's answer and close note, interview locations and scorecard takeaways. Those columns are nullable with length checks, and the form rules (answer required on the careers form, location required when scheduling, takeaways required to submit) stay in the app. The build test found applications had no field to mark this, and anonymized_at was added.

A submitted scorecard always has a recommendation

Section 7 makes the recommendation required to submit with no default, and No decision is an explicit value. A table check requires a recommendation and submitted_at whenever status is submitted, and no submitted_at otherwise. One scorecard per interviewer per interview is UNIQUE (interview_id, interviewer_id).

Role titles are unique only among roles that are not closed

Section 5 makes a title unique ignoring case among roles that are not closed, so a closed Product Designer role does not block a new one. A partial unique index on LOWER(title) WHERE status <> 'closed' does exactly that. An open role also needs a hiring manager and an opened_at, which a table check enforces.

The digest stores a timestamp, the outbox counts attempts

From the build test · field report

The build test found that the digest stored only the date of its last run, while listing applications received since the previous digest needs the time, and that retries had nothing to count. settings.last_digest_at is a timestamp and notifications.attempts counts send attempts, with retries stopping at 5.

Example queries

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

Board: open applications by role and stage

SQL
SELECT r.title AS role, a.stage, COUNT(*) AS applications FROM applications a JOIN roles r ON r.id = a.role_id WHERE a.stage IN ('applied', 'screen', 'interview', 'offer', 'hired') GROUP BY r.title, a.stage ORDER BY r.title, CASE a.stage WHEN 'applied' THEN 1 WHEN 'screen' THEN 2 WHEN 'interview' THEN 3 WHEN 'offer' THEN 4 ELSE 5 END;

On the seed data: 7 rows; Account Executive has 1 each in applied, interview and offer.

Scorecard summary per application

SQL
SELECT c.name AS candidate, SUM(CASE WHEN s.status = 'submitted' THEN 1 ELSE 0 END) AS submitted, COUNT(*) AS scorecards, SUM(CASE WHEN s.recommendation = 'strong_yes' THEN 1 ELSE 0 END) AS strong_yes, SUM(CASE WHEN s.recommendation = 'yes' THEN 1 ELSE 0 END) AS yes, SUM(CASE WHEN s.recommendation = 'no' THEN 1 ELSE 0 END) AS no, SUM(CASE WHEN s.recommendation = 'definitely_not' THEN 1 ELSE 0 END) AS definitely_not, SUM(CASE WHEN s.recommendation = 'no_decision' THEN 1 ELSE 0 END) AS no_decision FROM scorecards s JOIN interviews i ON i.id = s.interview_id JOIN applications a ON a.id = i.application_id JOIN candidates c ON c.id = a.candidate_id WHERE s.status <> 'cancelled' GROUP BY c.name ORDER BY c.name;

On the seed data: 4 rows; Sora Ito has 1 of 2 submitted (Yes 1), Ari Diaz 2 of 2 (Strong yes 1, Yes 1).

Pending scorecards that block Offer (R7)

SQL
SELECT c.name AS candidate, p.name AS pending_interviewer FROM applications a JOIN candidates c ON c.id = a.candidate_id JOIN interviews i ON i.application_id = a.id AND i.cancelled_at IS NULL JOIN scorecards s ON s.interview_id = i.id AND s.status = 'pending' JOIN people p ON p.id = s.interviewer_id WHERE a.stage = 'interview' ORDER BY c.name, p.name;

On the seed data: 1 row, Sora Ito with Sam Okafor pending, as in the worked example.

Ratings on one scorecard, in attribute order

SQL
SELECT ra.name AS attribute, CASE ar.rating WHEN 1 THEN '1 Weak' WHEN 2 THEN '2 Mixed' WHEN 3 THEN '3 Good' WHEN 4 THEN '4 Strong' ELSE 'Not assessed' END AS rating FROM attribute_ratings ar JOIN role_attributes ra ON ra.id = ar.attribute_id WHERE ar.scorecard_id = 's_sora_ben' ORDER BY ra.position;

On the seed data: 4 rows for Ben Cho on Sora Ito, from Discovery questions (3 Good) to Coachability (4 Strong).

Closed applications due for anonymization (R14)

SQL
SELECT c.name AS candidate, r.title AS role, a.stage, a.closed_at FROM applications a JOIN candidates c ON c.id = a.candidate_id JOIN roles r ON r.id = a.role_id WHERE a.stage IN ('rejected', 'withdrawn') AND a.anonymized_at IS NULL AND a.closed_at < '2026-04-16 12:00:00' ORDER BY a.closed_at;

On the seed data at T with retention 180 days: 1 row, Noor Haddad (Product Designer, rejected, closed 2026-03-27).

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 Hiring Pipeline blueprint, a free spec that also has the business rules, the screens, 4 phased build prompts and 29 acceptance checks for building the whole tool with an AI app builder. We built it from those prompts and the result passed 29 of 29 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.