Async standup app database schema

Twelve tables. check_ins carries the design: one row per member, standup and report date, with the prompt, due and close instants computed once in the member's schedule zone and stored in UTC, so a clock change never moves an old deadline. answers copy the question text so questions stay editable, and blockers live in their own table with a partial unique index that allows one open blocker per person per standup.

  • 12 tables, 9 indexes
  • Verified on SQLite 3.53.4 and PostgreSQL 19.0 (PGlite 0.6.1),
  • 303 seed rows from the blueprint
  • The blueprint's test build passed 32 of 32 acceptance checks

Copy the SQLDownload SQLDownload seed data

By Sam Claassen · From the Async Standups blueprint · MIT licensed · Markdown version

Async standups entity-relationship diagram

peopleidPK+ 6 more columnsstandupsidPKcreated_by→ people+ 12 more columnsstandup_daysstandup_idPK → standupsweekdayPKquestionsidPKstandup_id→ standups+ 5 more columnsquestion_optionsquestion_idPK → questionspositionPK+ 1 more columnmembersidPKstandup_id→ standupsperson_id→ people+ 5 more columnscheck_insidPKstandup_id→ standupsperson_id→ peoplenudged_by→ people+ 12 more columnsanswersidPKcheck_in_id→ check_insquestion_id→ questions+ 6 more columnsblockersidPKstandup_id→ standupsperson_id→ peopleopened_check_in_id→ check_insresolved_by→ peopleresolved_check_in_id→ check_ins+ 7 more columnsout_of_officeidPKperson_id→ people+ 4 more columnsnotificationsidPKstandup_id→ standupsperson_id→ peoplecheck_in_id→ check_ins+ 10 more columnssummary_runsidPKstandup_id→ standups+ 2 more columnspeopleidPK+ 6 more columnsstandupsidPKcreated_by→ people+ 12 more columnsstandup_daysstandup_idPK → standupsweekdayPKquestionsidPKstandup_id→ standups+ 5 more columnsquestion_optionsquestion_idPK → questionspositionPK+ 1 more columnmembersidPKstandup_id→ standupsperson_id→ people+ 5 more columnscheck_insidPKstandup_id→ standupsperson_id→ peoplenudged_by→ people+ 12 more columnsanswersidPKcheck_in_id→ check_insquestion_id→ questions+ 6 more columnsblockersidPKstandup_id→ standupsperson_id→ peopleopened_check_in_id→ check_insresolved_by→ peopleresolved_check_in_id→ check_ins+ 7 more columnsout_of_officeidPKperson_id→ people+ 4 more columnsnotificationsidPKstandup_id→ standupsperson_id→ peoplecheck_in_id→ check_ins+ 10 more columnssummary_runsidPKstandup_id→ standups+ 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

  • standups.created_by references people.id: each standups row points to exactly one people row, and one people row can have many standups rows pointing to it.
  • standup_days.standup_id references standups.id: each standup_days row points to exactly one standups row, and one standups row can have many standup_days rows pointing to it.
  • questions.standup_id references standups.id: each questions row points to exactly one standups row, and one standups 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.
  • members.standup_id references standups.id: each members row points to exactly one standups row, and one standups row can have many members rows pointing to it.
  • members.person_id references people.id: each members row points to exactly one people row, and one people row can have many members rows pointing to it.
  • check_ins.standup_id references standups.id: each check_ins row points to exactly one standups row, and one standups row can have many check_ins rows pointing to it.
  • check_ins.person_id references people.id: each check_ins row points to exactly one people row, and one people row can have many check_ins rows pointing to it.
  • check_ins.nudged_by references people.id: each check_ins row points to at most one people row, and one people row can have many check_ins rows pointing to it.
  • answers.check_in_id references check_ins.id: each answers row points to exactly one check_ins row, and one check_ins row can have many answers rows pointing to it.
  • answers.question_id references questions.id: each answers row points to exactly one questions row, and one questions row can have many answers rows pointing to it.
  • blockers.standup_id references standups.id: each blockers row points to exactly one standups row, and one standups row can have many blockers rows pointing to it.
  • blockers.person_id references people.id: each blockers row points to exactly one people row, and one people row can have many blockers rows pointing to it.
  • blockers.opened_check_in_id references check_ins.id: each blockers row points to exactly one check_ins row, and one check_ins row can have many blockers rows pointing to it.
  • blockers.resolved_by references people.id: each blockers row points to at most one people row, and one people row can have many blockers rows pointing to it.
  • blockers.resolved_check_in_id references check_ins.id: each blockers row points to at most one check_ins row, and one check_ins row can have many blockers rows pointing to it.
  • out_of_office.person_id references people.id: each out_of_office row points to exactly one people row, and one people row can have many out_of_office rows pointing to it.
  • notifications.standup_id references standups.id: each notifications row points to exactly one standups row, and one standups row can have many notifications 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.check_in_id references check_ins.id: each notifications row points to at most one check_ins row, and one check_ins row can have many notifications rows pointing to it. On delete: set null.
  • summary_runs.standup_id references standups.id: each summary_runs row points to exactly one standups row, and one standups row can have many summary_runs rows pointing to it.

Async standups tables

The schema has 12 tables. Every column below is read from the SQL file itself. Also described as: daily standup tool database design, standup bot database tables, team check-in app schema.

TableImplementsWhat a row is
peoplePersonA person on the team, with their time zone and admin flag.
standupsStandupOne standup with its schedule, reminder, summary time and Slack webhook.
standup_dayschild table of StandupOne ISO weekday a standup runs on.
questionsQuestionOne question on a standup's form, in position order.
question_optionschild table of QuestionOne option of a choice question, in button order.
membersMemberA person's place in a standup, with the reports, manager and email summary flags.
check_insCheckInOne member's check-in for one standup and report date, with its stored instants and status.
answersAnswerOne answer to one question in a check-in, with a copy of the question text.
blockersBlockerOne blocker a person reported in a standup, open until resolved.
out_of_officeOutOfOfficeOne out-of-office period of a person, inclusive report dates.
notificationsNotificationOne outgoing email or Slack post in the outbox.
summary_runsSummaryRunOne daily summary already sent for a standup and report date.

people

A person on the team. Deactivated, never deleted.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
nameTEXTnoCheck: LENGTH(name) BETWEEN 1 AND 80
emailTEXTnoUniquestored lowercaseCheck: email = LOWER(email)
time_zoneTEXTno'America/New_York'IANA name; the schedule zone for local-timing standups
is_adminBOOLEANnoFALSE
activeBOOLEANnoTRUE
created_atTIMESTAMPno
  • App rule (R13): there is always at least one active admin.

standups

One standup: its schedule, reminder, summary and Slack settings.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
nameTEXTnoCheck: LENGTH(name) BETWEEN 1 AND 60
statusTEXTno'active'Check: status IN ('active', 'paused')
paused_atTIMESTAMPyes
visibilityTEXTnoCheck: visibility IN ('team', 'members')
timingTEXTnolocal: each member's own zone; fixed: time_zone belowCheck: timing IN ('local', 'fixed')
time_zoneTEXTnoIANA name; the zone for fixed timing and for the summary
prompt_timeTEXTnoHH:MM, 24-hourCheck: prompt_time LIKE '__:__' AND prompt_time BETWEEN '04:00' AND '22:00'
due_timeTEXTnoHH:MM, 24-hourCheck: due_time LIKE '__:__' AND due_time BETWEEN '04:00' AND '22:00'
reminder_minutesINTEGERyesempty means no reminderCheck: reminder_minutes BETWEEN 15 AND 480
summary_timeTEXTyesHH:MM in time_zone, any time of day; empty means no summaryCheck: summary_time LIKE '__:__'
slack_webhook_urlTEXTyessecret: never shown in full after saving, never exported or logged
created_byTEXTnoReferences people.id
created_atTIMESTAMPno
  • Table check: due_time > prompt_time
  • Table check: (status = 'paused' AND paused_at IS NOT NULL) OR (status = 'active' AND paused_at IS NULL)
  • Unique index standups_name_uniq on (LOWER(name))
  • App rule (R3): prompt_time plus reminder_minutes must be earlier than due_time.

standup_days

One weekday a standup runs on (child table of Standup.days).

ColumnTypeNullDefaultKeyNotes
standup_idTEXTnoPrimary key (part); References standups.id
weekdayINTEGERnoPrimary key (part)ISO weekday: 1 = Monday, 7 = SundayCheck: weekday BETWEEN 1 AND 7
  • App rule (R3): every standup has at least one day.

questions

One question on a standup's form.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
standup_idTEXTnoReferences standups.id
positionINTEGERnoorder on the form
textTEXTnoCheck: LENGTH(text) BETWEEN 1 AND 200
kindTEXTnoCheck: kind IN ('text', 'choice', 'blocker')
requiredBOOLEANno
archived_atTIMESTAMPyesarchived questions leave new forms; their answers stay
  • Table check: kind <> 'blocker' OR required = TRUE
  • Index questions_standup_idx on (standup_id, position)
  • Unique index questions_one_blocker on (standup_id) where kind = 'blocker' AND archived_at IS NULL
  • App rule (R3): 1 to 8 active questions per standup; a question with answers can't change its kind; archiving is final.

question_options

One option of a choice question (child table of Question.options).

ColumnTypeNullDefaultKeyNotes
question_idTEXTnoPrimary key (part); References questions.id
positionINTEGERnoPrimary key (part)button order
labelTEXTnostored trimmedCheck: LENGTH(label) BETWEEN 1 AND 40
  • Unique index question_options_label_uniq on (question_id, LOWER(label))
  • App rule (R3): choice questions have 2 to 6 options; only choice questions have options.

members

A person's place in a standup, with their flags.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
standup_idTEXTnoReferences standups.id
person_idTEXTnoReferences people.id
reportsBOOLEANnogets check-ins
is_managerBOOLEANno
email_summaryBOOLEANno
joined_atTIMESTAMPnoset when added or re-added; never changed by flag edits
removed_atTIMESTAMPyes
  • Unique together: standup_id, person_id
  • App rule (R4): removing a member, or unticking reports, deletes their open check-ins that have no submission.

check_ins

One member's check-in for one standup and one report date. Created only by the scheduled job.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
standup_idTEXTnoReferences standups.id
person_idTEXTnoReferences people.id
report_dateDATEnocalendar date in schedule_zone
schedule_zoneTEXTnoIANA zone used, copied at creation
prompt_atTIMESTAMPnoreport_date at prompt_time in schedule_zone
due_atTIMESTAMPnoreport_date at due_time in schedule_zone
closes_atTIMESTAMPnothe next day at 00:00 in schedule_zone
statusTEXTnoCheck: status IN ('open', 'on_time', 'late', 'missed', 'away')
prompted_atTIMESTAMPyeswhen the prompt was queued; empty when created as away
reminded_atTIMESTAMPyes
nudged_atTIMESTAMPyesR14: once per check-in
nudged_byTEXTyesReferences people.id
submitted_atTIMESTAMPyesfirst submission; decides on_time (at or before due_at) or late (R7)
edited_atTIMESTAMPyeslast edit
created_atTIMESTAMPno
  • Unique together: standup_id, person_id, report_date
  • Table check: prompt_at < due_at AND due_at < closes_at
  • Table check: (status IN ('on_time', 'late') AND submitted_at IS NOT NULL) OR (status NOT IN ('on_time', 'late') AND submitted_at IS NULL)
  • Table check: edited_at IS NULL OR submitted_at IS NOT NULL
  • Table check: (nudged_at IS NULL AND nudged_by IS NULL) OR (nudged_at IS NOT NULL AND nudged_by IS NOT NULL)
  • Index check_ins_report_date_idx on (standup_id, report_date)
  • Index check_ins_open_idx on (closes_at) where status = 'open'
  • App rule (section 6): prompt_at, due_at and closes_at are computed once with the time zone database for the report date, never by adding fixed offsets.
  • App rule (section 7): missed and away are final; on_time and late can be edited until closes_at.

answers

One answer to one question in a check-in. Keeps its own copy of the question text.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
check_in_idTEXTnoReferences check_ins.id
question_idTEXTnoReferences questions.id
question_textTEXTnocopied when saved
kindTEXTnocopied when savedCheck: kind IN ('text', 'choice', 'blocker')
textTEXTyesfor a blocker question, the answer text from section 8 ("Blocked: ...")Check: LENGTH(text) <= 2000
choiceTEXTyes
blocker_actionTEXTyesblocker questions onlyCheck: blocker_action IN ('none', 'blocked', 'still_blocked', 'unblocked', 'blocked_other')
blocker_textTEXTyesthe new blocker's descriptionCheck: LENGTH(blocker_text) BETWEEN 1 AND 500
  • Unique together: check_in_id, question_id
  • Table check: kind = 'choice' OR choice IS NULL
  • Table check: kind <> 'choice' OR text IS NULL
  • Table check: kind = 'blocker' OR blocker_action IS NULL
  • Table check: CASE WHEN blocker_action IN ('blocked', 'blocked_other') THEN blocker_text IS NOT NULL ELSE blocker_text IS NULL END

blockers

One blocker a person reported in a standup, open until someone resolves it.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
standup_idTEXTnoReferences standups.id
person_idTEXTnoReferences people.id
textTEXTnoCheck: LENGTH(text) BETWEEN 1 AND 500
opened_check_in_idTEXTnoReferences check_ins.id
opened_onDATEnoreport date
opened_atTIMESTAMPnosubmitted_at of the opening check-in
last_reported_onDATEnoreport date of the latest "Still blocked"
statusTEXTnoCheck: status IN ('open', 'resolved')
resolved_atTIMESTAMPyes
resolved_byTEXTyesReferences people.id
resolved_check_in_idTEXTyesReferences check_ins.idset when resolved from a report
resolution_noteTEXTyesoptionalCheck: LENGTH(resolution_note) <= 300
  • Table check: (status = 'open' AND resolved_at IS NULL AND resolved_by IS NULL AND resolved_check_in_id IS NULL AND resolution_note IS NULL) OR (status = 'resolved' AND resolved_at IS NOT NULL AND resolved_by IS NOT NULL)
  • Table check: last_reported_on >= opened_on
  • Unique index blockers_one_open on (standup_id, person_id) where status = 'open'
  • App rule (R11): resolved by the person, a current manager of the standup or an admin; a resolved blocker is never reopened.

out_of_office

One out-of-office period of a person; applies to every standup they report in.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
person_idTEXTnoReferences people.id
start_dateDATEnoinclusive report date
end_dateDATEnoinclusive report date
noteTEXTyesoptionalCheck: LENGTH(note) <= 100
created_atTIMESTAMPno
  • Table check: end_date >= start_date
  • Index out_of_office_person_idx on (person_id, start_date)
  • App rule (R12): at most 90 days counting both ends; periods of one person never overlap; the start is not before today.

notifications

One outgoing email or Slack post in the outbox.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
channelTEXTnoCheck: channel IN ('email', 'slack')
kindTEXTnoCheck: kind IN ('prompt', 'reminder', 'nudge', 'report_post', 'blocker_opened', 'blocker_resolved', 'summary')
standup_idTEXTnoReferences standups.id
person_idTEXTyesReferences people.idempty for Slack
to_addressTEXTnothe spec's "to": an email address, or "Slack: <standup name>"
check_in_idTEXTyesReferences check_ins.id, on delete set nullcleared when R4 deletes the check-in; the row stays
subjectTEXTno
bodyTEXTnoplain text, unescaped
statusTEXTno'queued'logged = no email provider; not an attemptCheck: status IN ('queued', 'sent', 'logged', 'failed')
attemptsINTEGERno0each send attempt adds 1; retried until 5Check: attempts BETWEEN 0 AND 5
last_errorTEXTyes"HTTP 404: no_team" or the error message, never the webhook URL
created_atTIMESTAMPno
sent_atTIMESTAMPyes
  • Index notifications_status_idx on (status, attempts)

summary_runs

One daily summary already sent for a standup and report date; makes the job safe to repeat.

ColumnTypeNullDefaultKeyNotes
idTEXTnoPrimary key
standup_idTEXTnoReferences standups.id
report_dateDATEnoin the standup's time_zone
created_atTIMESTAMPno
  • Unique together: standup_id, report_date

The SQL

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

async-standups.sql
-- Async Standups database schema
-- Source: https://personalsoftwarefactory.com/blueprints/async-standups (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 person on the team. Deactivated, never deleted.
-- App rule (R13): there is always at least one active admin.
CREATE TABLE people (
  id TEXT PRIMARY KEY,
  name TEXT NOT NULL CHECK (LENGTH(name) BETWEEN 1 AND 80),
  email TEXT NOT NULL UNIQUE CHECK (email = LOWER(email)), -- stored lowercase
  time_zone TEXT NOT NULL DEFAULT 'America/New_York', -- IANA name; the schedule zone for local-timing standups
  is_admin BOOLEAN NOT NULL DEFAULT FALSE,
  active BOOLEAN NOT NULL DEFAULT TRUE,
  created_at TIMESTAMP NOT NULL
);

-- One standup: its schedule, reminder, summary and Slack settings.
-- App rule (R3): prompt_time plus reminder_minutes must be earlier than due_time.
CREATE TABLE standups (
  id TEXT PRIMARY KEY,
  name TEXT NOT NULL CHECK (LENGTH(name) BETWEEN 1 AND 60),
  status TEXT NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'paused')),
  paused_at TIMESTAMP,
  visibility TEXT NOT NULL CHECK (visibility IN ('team', 'members')),
  timing TEXT NOT NULL CHECK (timing IN ('local', 'fixed')), -- local: each member's own zone; fixed: time_zone below
  time_zone TEXT NOT NULL, -- IANA name; the zone for fixed timing and for the summary
  prompt_time TEXT NOT NULL CHECK (prompt_time LIKE '__:__' AND prompt_time BETWEEN '04:00' AND '22:00'), -- HH:MM, 24-hour
  due_time TEXT NOT NULL CHECK (due_time LIKE '__:__' AND due_time BETWEEN '04:00' AND '22:00'), -- HH:MM, 24-hour
  reminder_minutes INTEGER CHECK (reminder_minutes BETWEEN 15 AND 480), -- empty means no reminder
  summary_time TEXT CHECK (summary_time LIKE '__:__'), -- HH:MM in time_zone, any time of day; empty means no summary
  slack_webhook_url TEXT, -- secret: never shown in full after saving, never exported or logged
  created_by TEXT NOT NULL REFERENCES people(id),
  created_at TIMESTAMP NOT NULL,
  CHECK (due_time > prompt_time),
  CHECK ((status = 'paused' AND paused_at IS NOT NULL) OR (status = 'active' AND paused_at IS NULL))
);
CREATE UNIQUE INDEX standups_name_uniq ON standups (LOWER(name)); -- unique ignoring case

-- One weekday a standup runs on (child table of Standup.days).
-- App rule (R3): every standup has at least one day.
CREATE TABLE standup_days (
  standup_id TEXT NOT NULL REFERENCES standups(id),
  weekday INTEGER NOT NULL CHECK (weekday BETWEEN 1 AND 7), -- ISO weekday: 1 = Monday, 7 = Sunday
  PRIMARY KEY (standup_id, weekday)
);

-- One question on a standup's form.
-- App rule (R3): 1 to 8 active questions per standup; a question with answers can't change its kind; archiving is final.
CREATE TABLE questions (
  id TEXT PRIMARY KEY,
  standup_id TEXT NOT NULL REFERENCES standups(id),
  position INTEGER NOT NULL, -- order on the form
  text TEXT NOT NULL CHECK (LENGTH(text) BETWEEN 1 AND 200),
  kind TEXT NOT NULL CHECK (kind IN ('text', 'choice', 'blocker')),
  required BOOLEAN NOT NULL,
  archived_at TIMESTAMP, -- archived questions leave new forms; their answers stay
  CHECK (kind <> 'blocker' OR required = TRUE) -- a blocker question is always required
);
CREATE INDEX questions_standup_idx ON questions (standup_id, position);
CREATE UNIQUE INDEX questions_one_blocker ON questions (standup_id) WHERE kind = 'blocker' AND archived_at IS NULL; -- R3: at most one active blocker question

-- One option of a choice question (child table of Question.options).
-- App rule (R3): choice questions have 2 to 6 options; only choice questions have options.
CREATE TABLE question_options (
  question_id TEXT NOT NULL REFERENCES questions(id),
  position INTEGER NOT NULL, -- button order
  label TEXT NOT NULL CHECK (LENGTH(label) BETWEEN 1 AND 40), -- stored trimmed
  PRIMARY KEY (question_id, position)
);
CREATE UNIQUE INDEX question_options_label_uniq ON question_options (question_id, LOWER(label)); -- options differ ignoring case

-- A person's place in a standup, with their flags.
-- App rule (R4): removing a member, or unticking reports, deletes their open check-ins that have no submission.
CREATE TABLE members (
  id TEXT PRIMARY KEY,
  standup_id TEXT NOT NULL REFERENCES standups(id),
  person_id TEXT NOT NULL REFERENCES people(id),
  reports BOOLEAN NOT NULL, -- gets check-ins
  is_manager BOOLEAN NOT NULL,
  email_summary BOOLEAN NOT NULL,
  joined_at TIMESTAMP NOT NULL, -- set when added or re-added; never changed by flag edits
  removed_at TIMESTAMP,
  UNIQUE (standup_id, person_id)
);

-- One member's check-in for one standup and one report date. Created only by the scheduled job.
-- App rule (section 6): prompt_at, due_at and closes_at are computed once with the time zone database for the report date, never by adding fixed offsets.
-- App rule (section 7): missed and away are final; on_time and late can be edited until closes_at.
CREATE TABLE check_ins (
  id TEXT PRIMARY KEY,
  standup_id TEXT NOT NULL REFERENCES standups(id),
  person_id TEXT NOT NULL REFERENCES people(id),
  report_date DATE NOT NULL, -- calendar date in schedule_zone
  schedule_zone TEXT NOT NULL, -- IANA zone used, copied at creation
  prompt_at TIMESTAMP NOT NULL, -- report_date at prompt_time in schedule_zone
  due_at TIMESTAMP NOT NULL, -- report_date at due_time in schedule_zone
  closes_at TIMESTAMP NOT NULL, -- the next day at 00:00 in schedule_zone
  status TEXT NOT NULL CHECK (status IN ('open', 'on_time', 'late', 'missed', 'away')),
  prompted_at TIMESTAMP, -- when the prompt was queued; empty when created as away
  reminded_at TIMESTAMP,
  nudged_at TIMESTAMP, -- R14: once per check-in
  nudged_by TEXT REFERENCES people(id),
  submitted_at TIMESTAMP, -- first submission; decides on_time (at or before due_at) or late (R7)
  edited_at TIMESTAMP, -- last edit
  created_at TIMESTAMP NOT NULL,
  UNIQUE (standup_id, person_id, report_date),
  CHECK (prompt_at < due_at AND due_at < closes_at),
  CHECK ((status IN ('on_time', 'late') AND submitted_at IS NOT NULL) OR (status NOT IN ('on_time', 'late') AND submitted_at IS NULL)),
  CHECK (edited_at IS NULL OR submitted_at IS NOT NULL),
  CHECK ((nudged_at IS NULL AND nudged_by IS NULL) OR (nudged_at IS NOT NULL AND nudged_by IS NOT NULL))
);
CREATE INDEX check_ins_report_date_idx ON check_ins (standup_id, report_date);
CREATE INDEX check_ins_open_idx ON check_ins (closes_at) WHERE status = 'open';

-- One answer to one question in a check-in. Keeps its own copy of the question text.
CREATE TABLE answers (
  id TEXT PRIMARY KEY,
  check_in_id TEXT NOT NULL REFERENCES check_ins(id),
  question_id TEXT NOT NULL REFERENCES questions(id),
  question_text TEXT NOT NULL, -- copied when saved
  kind TEXT NOT NULL CHECK (kind IN ('text', 'choice', 'blocker')), -- copied when saved
  text TEXT CHECK (LENGTH(text) <= 2000), -- for a blocker question, the answer text from section 8 ("Blocked: ...")
  choice TEXT,
  blocker_action TEXT CHECK (blocker_action IN ('none', 'blocked', 'still_blocked', 'unblocked', 'blocked_other')), -- blocker questions only
  blocker_text TEXT CHECK (LENGTH(blocker_text) BETWEEN 1 AND 500), -- the new blocker's description
  UNIQUE (check_in_id, question_id),
  CHECK (kind = 'choice' OR choice IS NULL),
  CHECK (kind <> 'choice' OR text IS NULL),
  CHECK (kind = 'blocker' OR blocker_action IS NULL),
  CHECK (CASE WHEN blocker_action IN ('blocked', 'blocked_other') THEN blocker_text IS NOT NULL ELSE blocker_text IS NULL END) -- R8: a new blocker needs a description
);

-- One blocker a person reported in a standup, open until someone resolves it.
-- App rule (R11): resolved by the person, a current manager of the standup or an admin; a resolved blocker is never reopened.
CREATE TABLE blockers (
  id TEXT PRIMARY KEY,
  standup_id TEXT NOT NULL REFERENCES standups(id),
  person_id TEXT NOT NULL REFERENCES people(id),
  text TEXT NOT NULL CHECK (LENGTH(text) BETWEEN 1 AND 500),
  opened_check_in_id TEXT NOT NULL REFERENCES check_ins(id),
  opened_on DATE NOT NULL, -- report date
  opened_at TIMESTAMP NOT NULL, -- submitted_at of the opening check-in
  last_reported_on DATE NOT NULL, -- report date of the latest "Still blocked"
  status TEXT NOT NULL CHECK (status IN ('open', 'resolved')),
  resolved_at TIMESTAMP,
  resolved_by TEXT REFERENCES people(id),
  resolved_check_in_id TEXT REFERENCES check_ins(id), -- set when resolved from a report
  resolution_note TEXT CHECK (LENGTH(resolution_note) <= 300), -- optional
  CHECK ((status = 'open' AND resolved_at IS NULL AND resolved_by IS NULL AND resolved_check_in_id IS NULL AND resolution_note IS NULL) OR (status = 'resolved' AND resolved_at IS NOT NULL AND resolved_by IS NOT NULL)),
  CHECK (last_reported_on >= opened_on)
);
CREATE UNIQUE INDEX blockers_one_open ON blockers (standup_id, person_id) WHERE status = 'open'; -- R10: one open blocker per person per standup

-- One out-of-office period of a person; applies to every standup they report in.
-- App rule (R12): at most 90 days counting both ends; periods of one person never overlap; the start is not before today.
CREATE TABLE out_of_office (
  id TEXT PRIMARY KEY,
  person_id TEXT NOT NULL REFERENCES people(id),
  start_date DATE NOT NULL, -- inclusive report date
  end_date DATE NOT NULL, -- inclusive report date
  note TEXT CHECK (LENGTH(note) <= 100), -- optional
  created_at TIMESTAMP NOT NULL,
  CHECK (end_date >= start_date)
);
CREATE INDEX out_of_office_person_idx ON out_of_office (person_id, start_date);

-- One outgoing email or Slack post in the outbox.
CREATE TABLE notifications (
  id TEXT PRIMARY KEY,
  channel TEXT NOT NULL CHECK (channel IN ('email', 'slack')),
  kind TEXT NOT NULL CHECK (kind IN ('prompt', 'reminder', 'nudge', 'report_post', 'blocker_opened', 'blocker_resolved', 'summary')),
  standup_id TEXT NOT NULL REFERENCES standups(id),
  person_id TEXT REFERENCES people(id), -- empty for Slack
  to_address TEXT NOT NULL, -- the spec's "to": an email address, or "Slack: <standup name>"
  check_in_id TEXT REFERENCES check_ins(id) ON DELETE SET NULL, -- cleared when R4 deletes the check-in; the row stays
  subject TEXT NOT NULL,
  body TEXT NOT NULL, -- plain text, unescaped
  status TEXT NOT NULL DEFAULT 'queued' CHECK (status IN ('queued', 'sent', 'logged', 'failed')), -- logged = no email provider; not an attempt
  attempts INTEGER NOT NULL DEFAULT 0 CHECK (attempts BETWEEN 0 AND 5), -- each send attempt adds 1; retried until 5
  last_error TEXT, -- "HTTP 404: no_team" or the error message, never the webhook URL
  created_at TIMESTAMP NOT NULL,
  sent_at TIMESTAMP
);
CREATE INDEX notifications_status_idx ON notifications (status, attempts);

-- One daily summary already sent for a standup and report date; makes the job safe to repeat.
CREATE TABLE summary_runs (
  id TEXT PRIMARY KEY,
  standup_id TEXT NOT NULL REFERENCES standups(id),
  report_date DATE NOT NULL, -- in the standup's time_zone
  created_at TIMESTAMP NOT NULL,
  UNIQUE (standup_id, report_date)
);

Seed data

Loads all of section 15: 9 people, 2 standups with their 6 weekday rows, 7 questions with 6 choice options, 11 members, Tom Bennett's out-of-office period, 61 check-ins (the Product daily grid, the two Leadership weekly Mondays and today's 6), 195 answers and 5 blockers. Check-in instants were computed from each schedule zone with the time zone database. Reports the spec does not list use its default answers, including the unlisted questions of the listed reports. The outbox and summary runs are empty, as the spec says.

Download async-standups-seed.sql (303 rows). It loads with foreign keys enforced on both engines.

Load it

SQLite, into a new file:

sqlite3
curl -s https://personalsoftwarefactory.com/schemas/async-standups.sql https://personalsoftwarefactory.com/schemas/async-standups-seed.sql | sqlite3 async_standups.db

PostgreSQL, into a new database:

psql
createdb async_standups && curl -s https://personalsoftwarefactory.com/schemas/async-standups.sql https://personalsoftwarefactory.com/schemas/async-standups-seed.sql | psql -v ON_ERROR_STOP=1 async_standups

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

Design decisions

Check-in instants are stored, not recalculated

Section 6 computes prompt_at, due_at and closes_at once, with the time zone database for the report date, and never recalculates them. Storing them in UTC on check_ins lets the job, the feed and Insights compare against now with plain SQL. Code that stores one offset per person gets the week of Mon 26 Oct 2026 wrong, when London is four hours ahead of New York instead of five.

Unique keys make the job safe to repeat

Section 13 says running the job twice creates nothing new because of the unique keys on CheckIn and SummaryRun. check_ins is UNIQUE on (standup_id, person_id, report_date) and summary_runs on (standup_id, report_date), so a second run, or two at once, fails the insert instead of sending a second prompt or summary.

One open blocker is a partial unique index

From the build test · field report

R10 allows at most one open blocker per person per standup, enforced with a unique key. A plain UNIQUE would also forbid a second resolved blocker, so the index covers only rows WHERE status = 'open'. The build test found a gap here: R10 covered a blocker resolved after the form loaded but not one opened meanwhile; the index is what makes the second case fail safely.

Answers copy the question text and kind

From the build test · field report

Section 5 lets a question's text, required flag and options change after it has answers, because each answer keeps its own copy. answers.question_text and answers.kind are copied on save, so the feed, the export and the Last time line show what the person was actually asked. A blocker answer stores its section 8 text ("Blocked: ...") in text and the action in blocker_action. The build test found the seed didn't say what text a blocker answer stores; it is now the section 8 text.

Days and options are child tables

From the build test · field report

Standup.days and Question.options are lists in the spec. standup_days stores one ISO weekday per row with a 1 to 7 CHECK, and question_options one label per row with a unique index on LOWER(label), which enforces R3's "different options, compared ignoring case" in the database. The counts (at least one day, 2 to 6 options) are cross-row rules and stay in the app. The build test found "different" options didn't say whether Good and good differ; they are compared trimmed and ignoring case.

Outbox rows outlive deleted check-ins

From the build test · field report

R4 deletes a removed member's open, unsubmitted check-ins, and section 5 says the notification row stays with check_in_id cleared. ON DELETE SET NULL on notifications.check_in_id does exactly that. The build test found that nothing said what happened to those outbox rows; this is the fix.

The spec's "to" column is to_address

Notification has a field named to, which is a reserved word in PostgreSQL and would need quoting everywhere. It is stored as to_address with the same meaning: an email address, or "Slack: <standup name>" for a Slack post.

Example queries

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

Day status for the feed and the summary

SQL
SELECT p.name, CASE WHEN c.status IN ('on_time', 'late') THEN 'reported' WHEN c.status = 'away' THEN 'away' WHEN c.status = 'missed' OR (c.status = 'open' AND c.closes_at <= '2026-10-14 14:00:00') THEN 'missed' ELSE 'waiting' END AS day_status, c.submitted_at FROM members m JOIN people p ON p.id = m.person_id LEFT JOIN check_ins c ON c.standup_id = m.standup_id AND c.person_id = m.person_id AND c.report_date = '2026-10-14' WHERE m.standup_id = 'standup_product_daily' AND m.reports = TRUE AND m.removed_at IS NULL ORDER BY CASE WHEN c.status IN ('on_time', 'late') THEN 0 WHEN c.status = 'away' THEN 3 WHEN c.status = 'missed' OR (c.status = 'open' AND c.closes_at <= '2026-10-14 14:00:00') THEN 2 ELSE 1 END, c.submitted_at, p.name;

On the seed data at Wed 14 Oct 2026 14:00 UTC: 7 rows, Priya Nair, Maya Chen and Sam Okafor reported, Ben Cho, Jo Park and Lee Park waiting, Tom Bennett away (3 of 6 reported). Lee has no check-in yet; the app decides waiting from his schedule.

Participation per person (Insights)

SQL
SELECT name, on_time, late, missed, away, reported, counted, CASE WHEN counted = 0 THEN NULL ELSE (200 * reported + counted) / (2 * counted) END AS rate_percent FROM (SELECT p.name, SUM(CASE WHEN c.status = 'on_time' THEN 1 ELSE 0 END) AS on_time, SUM(CASE WHEN c.status = 'late' THEN 1 ELSE 0 END) AS late, SUM(CASE WHEN c.status = 'missed' OR (c.status = 'open' AND c.closes_at <= '2026-10-14 14:00:00') THEN 1 ELSE 0 END) AS missed, SUM(CASE WHEN c.status = 'away' THEN 1 ELSE 0 END) AS away, SUM(CASE WHEN c.status IN ('on_time', 'late') THEN 1 ELSE 0 END) AS reported, SUM(CASE WHEN c.status IN ('on_time', 'late', 'missed') OR (c.status = 'open' AND c.closes_at <= '2026-10-14 14:00:00') THEN 1 ELSE 0 END) AS counted FROM check_ins c JOIN people p ON p.id = c.person_id WHERE c.standup_id = 'standup_product_daily' AND c.report_date BETWEEN '2026-09-30' AND '2026-10-13' GROUP BY p.name) per_person ORDER BY name;

On the seed data for Wed 30 Sep to Tue 13 Oct: 7 rows, matching section 10's worked example, for example Jo Park 3 on time, 1 late, 3 missed, 4 of 7, 57%.

Team participation row

SQL
SELECT SUM(CASE WHEN status IN ('on_time', 'late') THEN 1 ELSE 0 END) AS reported, SUM(CASE WHEN status IN ('on_time', 'late', 'missed') OR (status = 'open' AND closes_at <= '2026-10-14 14:00:00') THEN 1 ELSE 0 END) AS counted, (200 * SUM(CASE WHEN status IN ('on_time', 'late') THEN 1 ELSE 0 END) + SUM(CASE WHEN status IN ('on_time', 'late', 'missed') OR (status = 'open' AND closes_at <= '2026-10-14 14:00:00') THEN 1 ELSE 0 END)) / (2 * SUM(CASE WHEN status IN ('on_time', 'late', 'missed') OR (status = 'open' AND closes_at <= '2026-10-14 14:00:00') THEN 1 ELSE 0 END)) AS rate_percent FROM check_ins WHERE standup_id = 'standup_product_daily' AND report_date BETWEEN '2026-10-05' AND '2026-10-14';

On the seed data for Mon 5 to Wed 14 Oct: 1 row, 45 of 50 (90%), as in section 10; Jo's and Ben's open check-ins are not counted yet.

Open blockers, oldest first

SQL
SELECT p.name, s.name AS standup, b.text, b.opened_on, b.last_reported_on FROM blockers b JOIN people p ON p.id = b.person_id JOIN standups s ON s.id = b.standup_id WHERE b.status = 'open' ORDER BY b.opened_on, b.opened_at, p.name;

On the seed data: 3 rows, Dana Ruiz (Leadership weekly, since 2026-10-12), Jo Park (Need staging database access from Ana, since 2026-10-13) and Sam Okafor (since 2026-10-14).

The Last time line on Jo's form

SQL
SELECT a.question_text, COALESCE(a.text, a.choice) AS last_answer FROM answers a JOIN questions q ON q.id = a.question_id WHERE a.check_in_id = (SELECT c.id FROM check_ins c WHERE c.standup_id = 'standup_product_daily' AND c.person_id = 'person_jo' AND c.status IN ('on_time', 'late') AND c.report_date < '2026-10-14' ORDER BY c.report_date DESC LIMIT 1) ORDER BY q.position;

On the seed data: 4 rows from Jo's Tue 13 Oct report, for example "Fixed the login crash on Android 15" and "Blocked: Need staging database access from Ana".

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