# Project status tracking database schema

Source: https://personalsoftwarefactory.com/schemas/project-status-board
Updated: 2026-12-04

> A weekly project status board needs six tables: people, settings, projects, updates, activities and notifications. The design is carried by updates, with a unique key on (project_id, week_start) so each project has at most one health and note per week and a second save revises it. A missing update is never stored: it is a week where an active project that had started has no row.

- 6 tables, 5 indexes
- Verified on SQLite 3.53.4 and PostgreSQL 19.0 (PGlite 0.6.1) on 2026-12-04
- 42 seed rows from the blueprint
- The blueprint's test build passed 28 of 28 acceptance checks

Files: [project-status-board.sql](https://personalsoftwarefactory.com/schemas/project-status-board.sql) · [project-status-board-seed.sql](https://personalsoftwarefactory.com/schemas/project-status-board-seed.sql) · [the Project Status Board blueprint](https://personalsoftwarefactory.com/blueprints/project-status-board)

## Relationships

- projects.owner_id references people.id: each projects row points to exactly one people row, and one people row can have many projects rows pointing to it.
- projects.created_by references people.id: each projects row points to exactly one people row, and one people row can have many projects rows pointing to it.
- updates.project_id references projects.id: each updates row points to exactly one projects row, and one projects row can have many updates rows pointing to it.
- updates.posted_by references people.id: each updates row points to exactly one people row, and one people row can have many updates rows pointing to it.
- activities.project_id references projects.id: each activities row points to exactly one projects row, and one projects row can have many activities rows pointing to it.
- activities.actor_id references people.id: each activities row points to exactly one people row, and one people row can have many activities 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.

## Tables

Also described as: weekly status report database design, project health tracker tables, RAG status board data model.

### people

One row per person on the team, with their admin flag and whether they are active. Implements: Person.

| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
| `id` | TEXT | no |  | Primary key |  |
| `name` | TEXT | no |  |  | Check: `length(name) >= 1` |
| `email` | TEXT | no |  | Unique | stored lowercase Check: `email = lower(email)` |
| `is_admin` | BOOLEAN | no | `FALSE` |  |  |
| `active` | BOOLEAN | no | `TRUE` |  |  |

- App rule (R10): deactivating someone who owns an active project is refused, and there must always be at least one active admin.

### settings

The single row of team settings: name, time zone, update day, reminder and report times, report recipients. Implements: Settings.

| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
| `id` | INTEGER | no |  | Primary key | one row only Check: `id = 1` |
| `team_name` | TEXT | no |  |  | used in the report title Check: `length(team_name) BETWEEN 1 AND 60` |
| `time_zone` | TEXT | no | `'America/New_York'` |  | IANA name; decides today, weeks and job times |
| `update_weekday` | INTEGER | no | `1` |  | 1 = Monday to 7 = Sunday Check: `update_weekday BETWEEN 1 AND 7` |
| `reminder_time` | TEXT | no | `'09:00'` |  | HH:MM, 24-hour, team time Check: `reminder_time LIKE '__:__' AND reminder_time BETWEEN '00:00' AND '23:59' AND substr(reminder_time, 4, 2) < '60'` |
| `report_time` | TEXT | no | `'15:00'` |  | HH:MM, 24-hour, team time Check: `report_time LIKE '__:__' AND report_time BETWEEN '00:00' AND '23:59' AND substr(report_time, 4, 2) < '60'` |
| `report_recipients` | TEXT | no | `''` |  | email addresses separated by commas; empty means the scheduled report is skipped |
| `last_reminder_week` | DATE | yes |  |  | written only by the scheduled job: the Monday of the last week reminded |
| `last_report_week` | DATE | yes |  |  | written only by the scheduled job: the Monday of the last week reported |

- Table check: `report_time > reminder_time`

### projects

One row per project, with its owner, target date, start week and archive time. Implements: Project.

| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
| `id` | TEXT | no |  | Primary key |  |
| `name` | TEXT | no |  |  | trimmed; unique ignoring case across active and archived projects (index below) Check: `length(name) BETWEEN 1 AND 100` |
| `owner_id` | TEXT | no |  | References people.id |  |
| `target_date` | DATE | no |  |  | may be in the past; the board then shows past target date (R13) |
| `start_week` | DATE | no |  |  | always a Monday: the week the project was created; never edited |
| `archived_at` | TIMESTAMP | yes |  |  | empty while active |
| `created_by` | TEXT | no |  | References people.id |  |
| `created_at` | TIMESTAMP | no | `CURRENT_TIMESTAMP` |  |  |

- Unique index `projects_name_idx` on (lower(name)). Project names are unique ignoring case (R8).
- Index `projects_owner_idx` on (owner_id)
- App rule (R9): only the owner or an admin can edit, change the owner, archive or restore.
- App rule (R10): owner_id must point at an active person.
- App rule (R7): an archived project is read-only and left out of the board, missing counts, reminders and reports.

### updates

One row per project per week: the owner's health, note and revision count. Implements: Update.

| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
| `id` | TEXT | no |  | Primary key |  |
| `project_id` | TEXT | no |  | References projects.id |  |
| `week_start` | DATE | no |  |  | always a Monday in the team time zone |
| `health` | TEXT | no |  |  | shown as On track, At risk, Blocked Check: `health IN ('on_track', 'at_risk', 'blocked')` |
| `note` | TEXT | no |  |  | trimmed, line breaks turned into spaces (R4) Check: `length(note) BETWEEN 1 AND 500` |
| `posted_by` | TEXT | no |  | References people.id | who saved it last; kept when the owner changes (R11) |
| `posted_at` | TIMESTAMP | no |  |  | time of the last save |
| `revision` | INTEGER | no | `1` |  | 1 on the first post, plus 1 on each revision Check: `revision >= 1` |

- Unique together: `project_id`, `week_start`
- Index `updates_week_idx` on (week_start). The board and the report read updates by week.
- App rule (R1): only the project's current owner posts or revises; admins get no exception.
- App rule (R2): only the current week, computed on the server in the team time zone, can be posted or revised.
- App rule (R5): the app never writes health on its own or copies it into a week without an update.

### activities

One row per action on a project, in an append-only log. Implements: Activity.

| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
| `id` | TEXT | no |  | Primary key |  |
| `project_id` | TEXT | no |  | References projects.id |  |
| `actor_id` | TEXT | no |  | References people.id |  |
| `type` | TEXT | no |  |  | Check: `type IN ('project_created', 'project_edited', 'owner_changed', 'archived', 'restored', 'update_posted', 'update_revised')` |
| `data` | TEXT | yes |  |  | JSON as text: old and new values, such as from and to owner or old and new health and note |
| `created_at` | TIMESTAMP | no | `CURRENT_TIMESTAMP` |  |  |

- Index `activities_project_idx` on (project_id, created_at)
- App rule (R12): every action in section 7 writes its row; rows are never edited or deleted.

### notifications

One row per reminder, report or owner-change email, written before sending. Implements: Notification.

| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
| `id` | TEXT | no |  | Primary key |  |
| `kind` | TEXT | no |  |  | Check: `kind IN ('reminder', 'report', 'owner_changed')` |
| `to_email` | TEXT | no |  |  |  |
| `person_id` | TEXT | yes |  | References people.id | empty for report recipients outside the team |
| `week_start` | DATE | yes |  |  | the week a reminder or report is for |
| `subject` | TEXT | no |  |  |  |
| `body` | TEXT | no |  |  | plain text |
| `status` | TEXT | no | `'pending'` |  | logged when no email provider is configured Check: `status IN ('pending', 'sent', 'logged', 'failed')` |
| `error` | TEXT | yes |  |  | the last send error, if any |
| `attempts` | INTEGER | no | `0` |  | each send attempt adds 1; 3 in all Check: `attempts BETWEEN 0 AND 3` |
| `created_at` | TIMESTAMP | no | `CURRENT_TIMESTAMP` |  |  |
| `sent_at` | TIMESTAMP | yes |  |  |  |

- Index `notifications_failed_idx` on (created_at) where `status = 'failed'`. The hourly job retries failed notifications only.
- App rule (section 12): a failed send is retried by the hourly job until it has had 3 attempts; a failure never blocks a save.

## The SQL

```sql
-- Project Status Board database schema
-- Source: https://personalsoftwarefactory.com/blueprints/project-status-board (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.

-- One row per person on the team.
-- App rule (R10): deactivating someone who owns an active project is refused, and there must always be at least one active admin.
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 one team and board.
CREATE TABLE settings (
  id INTEGER PRIMARY KEY CHECK (id = 1), -- one row only
  team_name TEXT NOT NULL CHECK (length(team_name) BETWEEN 1 AND 60), -- used in the report title
  time_zone TEXT NOT NULL DEFAULT 'America/New_York', -- IANA name; decides today, weeks and job times
  update_weekday INTEGER NOT NULL DEFAULT 1 CHECK (update_weekday BETWEEN 1 AND 7), -- 1 = Monday to 7 = Sunday
  reminder_time TEXT NOT NULL DEFAULT '09:00' CHECK (reminder_time LIKE '__:__' AND reminder_time BETWEEN '00:00' AND '23:59' AND substr(reminder_time, 4, 2) < '60'), -- HH:MM, 24-hour, team time
  report_time TEXT NOT NULL DEFAULT '15:00' CHECK (report_time LIKE '__:__' AND report_time BETWEEN '00:00' AND '23:59' AND substr(report_time, 4, 2) < '60'), -- HH:MM, 24-hour, team time
  report_recipients TEXT NOT NULL DEFAULT '', -- email addresses separated by commas; empty means the scheduled report is skipped
  last_reminder_week DATE, -- written only by the scheduled job: the Monday of the last week reminded
  last_report_week DATE, -- written only by the scheduled job: the Monday of the last week reported
  CHECK (report_time > reminder_time)
);

-- One row per project on the board. Projects are archived, never deleted.
-- App rule (R9): only the owner or an admin can edit, change the owner, archive or restore.
-- App rule (R10): owner_id must point at an active person.
-- App rule (R7): an archived project is read-only and left out of the board, missing counts, reminders and reports.
CREATE TABLE projects (
  id TEXT PRIMARY KEY,
  name TEXT NOT NULL CHECK (length(name) BETWEEN 1 AND 100), -- trimmed; unique ignoring case across active and archived projects (index below)
  owner_id TEXT NOT NULL REFERENCES people(id),
  target_date DATE NOT NULL, -- may be in the past; the board then shows past target date (R13)
  start_week DATE NOT NULL, -- always a Monday: the week the project was created; never edited
  archived_at TIMESTAMP, -- empty while active
  created_by TEXT NOT NULL REFERENCES people(id),
  created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

-- One row per project per week: the owner's health and note for that week. Revising replaces the row's values.
-- App rule (R1): only the project's current owner posts or revises; admins get no exception.
-- App rule (R2): only the current week, computed on the server in the team time zone, can be posted or revised.
-- App rule (R5): the app never writes health on its own or copies it into a week without an update.
CREATE TABLE updates (
  id TEXT PRIMARY KEY,
  project_id TEXT NOT NULL REFERENCES projects(id),
  week_start DATE NOT NULL, -- always a Monday in the team time zone
  health TEXT NOT NULL CHECK (health IN ('on_track', 'at_risk', 'blocked')), -- shown as On track, At risk, Blocked
  note TEXT NOT NULL CHECK (length(note) BETWEEN 1 AND 500), -- trimmed, line breaks turned into spaces (R4)
  posted_by TEXT NOT NULL REFERENCES people(id), -- who saved it last; kept when the owner changes (R11)
  posted_at TIMESTAMP NOT NULL, -- time of the last save
  revision INTEGER NOT NULL DEFAULT 1 CHECK (revision >= 1), -- 1 on the first post, plus 1 on each revision
  UNIQUE (project_id, week_start)
);

-- The append-only activity log of a project.
-- App rule (R12): every action in section 7 writes its row; rows are never edited or deleted.
CREATE TABLE activities (
  id TEXT PRIMARY KEY,
  project_id TEXT NOT NULL REFERENCES projects(id),
  actor_id TEXT NOT NULL REFERENCES people(id),
  type TEXT NOT NULL CHECK (type IN ('project_created', 'project_edited', 'owner_changed', 'archived', 'restored', 'update_posted', 'update_revised')),
  data TEXT, -- JSON as text: old and new values, such as from and to owner or old and new health and note
  created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

-- The email outbox: one row per message, written before sending.
-- App rule (section 12): a failed send is retried by the hourly job until it has had 3 attempts; a failure never blocks a save.
CREATE TABLE notifications (
  id TEXT PRIMARY KEY,
  kind TEXT NOT NULL CHECK (kind IN ('reminder', 'report', 'owner_changed')),
  to_email TEXT NOT NULL,
  person_id TEXT REFERENCES people(id), -- empty for report recipients outside the team
  week_start DATE, -- the week a reminder or report is for
  subject TEXT NOT NULL,
  body TEXT NOT NULL, -- plain text
  status TEXT NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'sent', 'logged', 'failed')), -- logged when no email provider is configured
  error TEXT, -- the last send error, if any
  attempts INTEGER NOT NULL DEFAULT 0 CHECK (attempts BETWEEN 0 AND 3), -- each send attempt adds 1; 3 in all
  created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  sent_at TIMESTAMP
);

-- Project names are unique ignoring case (R8).
CREATE UNIQUE INDEX projects_name_idx ON projects (lower(name));

-- The board and the report read updates by week.
CREATE INDEX updates_week_idx ON updates (week_start);
CREATE INDEX projects_owner_idx ON projects (owner_id);
CREATE INDEX activities_project_idx ON activities (project_id, created_at);

-- The hourly job retries failed notifications only.
CREATE INDEX notifications_failed_idx ON notifications (created_at) WHERE status = 'failed';
```

## Seed data

Loads all of section 15: the settings row, 7 people, 4 projects, 13 updates, and the 17 activity rows the spec asks for (one project_created per project, one update_posted per update). Dates are fixed at T = Tue Oct 13, 2026, the day the spec's worked examples use, and the moment of seeding is taken as 10:00 New York time that day. Job titles from the people table have no column and are not loaded; activity data is empty because the spec gives none; the outbox starts empty, as the spec says.

## Load it

```sh
# SQLite
curl -s https://personalsoftwarefactory.com/schemas/project-status-board.sql https://personalsoftwarefactory.com/schemas/project-status-board-seed.sql | sqlite3 project_status_board.db
# PostgreSQL
createdb project_status_board && curl -s https://personalsoftwarefactory.com/schemas/project-status-board.sql https://personalsoftwarefactory.com/schemas/project-status-board-seed.sql | psql -v ON_ERROR_STOP=1 project_status_board
```

## Design decisions

### One update per project per week, enforced by a unique key

Rule R3 says one update per project per week, enforced by the database, and that saving again revises it. The unique key on (project_id, week_start) does that, and the revision column counts saves (section 7). Section 14 relies on it: when an owner saves from two tabs at once, the key and an upsert in one transaction leave one row, and the second save counts as a revision.

### Missing updates are computed, never stored

Rule R6 defines a missing update as an active project whose start_week is on or before the week and that has no update row for it, and R5 forbids the app from writing or copying a health on its own. So there is no placeholder row and no status column for missing. The board shows No update from the absence of a row, and weeks before start_week are Not started rather than missing.

### Weeks are stored as their Monday

Section 6 identifies a week by its Monday in the team time zone, so updates.week_start and projects.start_week are plain dates. Computing that Monday needs a time-zone library, because Sunday 23:30 in New York is already Monday in UTC; the app does it, and the database only stores the result. Checking that a date is a Monday needs engine-specific date functions, so that check is left to the app.

### Archiving is a timestamp, not a flag

Section 9 shows an archived project's squares as Archived only for weeks after the week it was archived, and the CSV export runs to that week. A boolean flag would lose when that happened, so projects.archived_at holds the time and is cleared on Restore. Rule R7 then keeps archived projects out of the board, the counts, the reminders and every report.

### Notifications count their send attempts

Section 12 retries a failed email on the next run of the job, up to 3 attempts in all, and the attempts column, checked to stay between 0 and 3, carries that. The build test found that failed emails were retried forever, with nothing counting the attempts (gap 5); the spec now counts attempts and stops after 3. (This point comes from a gap the blueprint's build test found.)

### The report time must be later than the reminder time

Section 5 refuses a report_time that is not later than reminder_time. Both are stored as zero-padded HH:MM text, so a plain text comparison orders them correctly and the rule fits in one table check. The settings table has a single row, pinned by a primary key that can only be 1.

## Example queries

### The board grid: four weeks of health per project

```sql
SELECT p.name, o.name AS owner, p.target_date, CASE WHEN p.start_week > '2026-09-21' THEN 'Not started' ELSE COALESCE((SELECT u.health FROM updates u WHERE u.project_id = p.id AND u.week_start = '2026-09-21'), 'No update') END AS week_sep_21, CASE WHEN p.start_week > '2026-09-28' THEN 'Not started' ELSE COALESCE((SELECT u.health FROM updates u WHERE u.project_id = p.id AND u.week_start = '2026-09-28'), 'No update') END AS week_sep_28, CASE WHEN p.start_week > '2026-10-05' THEN 'Not started' ELSE COALESCE((SELECT u.health FROM updates u WHERE u.project_id = p.id AND u.week_start = '2026-10-05'), 'No update') END AS week_oct_5, CASE WHEN p.start_week > '2026-10-12' THEN 'Not started' ELSE COALESCE((SELECT u.health FROM updates u WHERE u.project_id = p.id AND u.week_start = '2026-10-12'), 'No update') END AS week_oct_12 FROM projects p JOIN people o ON o.id = p.owner_id WHERE p.archived_at IS NULL ORDER BY p.name;
```

On the seed data: 4 rows, the worked example in section 9. CRM migration reads on_track, on_track, on_track, blocked; Hiring plan has No update for Sep 28 and Oct 12; Q4 pricing is Not started on Sep 21.

### Board header: projects updated out of projects expected

```sql
SELECT COUNT(u.id) AS updated, COUNT(*) AS expected FROM projects p LEFT JOIN updates u ON u.project_id = p.id AND u.week_start = '2026-10-12' WHERE p.archived_at IS NULL AND p.start_week <= '2026-10-12';
```

On the seed data for the week of Oct 12, 2026: 1 row, 3 updated of 4 expected ("3 of 4 projects updated").

### Missing updates panel

```sql
SELECT p.name, o.name AS owner FROM projects p JOIN people o ON o.id = p.owner_id WHERE p.archived_at IS NULL AND p.start_week <= '2026-10-12' AND NOT EXISTS (SELECT 1 FROM updates u WHERE u.project_id = p.id AND u.week_start = '2026-10-12') ORDER BY p.name;
```

On the seed data for the week of Oct 12, 2026: 1 row, Hiring plan (Maya Chen).

### Weekly report lines in report order

```sql
SELECT COALESCE(u.health, 'no_update') AS report_group, p.name, o.name AS owner, p.target_date, u.note, CASE WHEN prev.health IS NOT NULL AND prev.health <> u.health THEN prev.health END AS was_last_week FROM projects p JOIN people o ON o.id = p.owner_id LEFT JOIN updates u ON u.project_id = p.id AND u.week_start = '2026-10-12' LEFT JOIN updates prev ON prev.project_id = p.id AND prev.week_start = '2026-10-05' WHERE p.archived_at IS NULL AND p.start_week <= '2026-10-12' ORDER BY CASE COALESCE(u.health, 'no_update') WHEN 'blocked' THEN 1 WHEN 'at_risk' THEN 2 WHEN 'on_track' THEN 3 ELSE 4 END, p.target_date, p.name;
```

On the seed data for the week of Oct 12, 2026: 4 rows in the order of the section 10 example. CRM migration is first (blocked, was on_track last week), then Q4 pricing, Website relaunch, and Hiring plan with no update.

## 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 is section 5 of the [Project Status Board blueprint](https://personalsoftwarefactory.com/blueprints/project-status-board), which also has the business rules, the screens, the phased build prompts and the acceptance checks. Paste-ready spec: https://personalsoftwarefactory.com/blueprints/project-status-board/blueprint.md
