IT asset management database schema
Nine tables. items carries the design: a permanent tag, a status, and a holder that is set exactly when the status is assigned, enforced by a CHECK. Every period an item is held is a row in assignments, with a partial unique index allowing one open assignment per item, so the history of who had what is never overwritten. Serial numbers are unique only among items that are not retired, ignoring case, through a partial expression index.
- 9 tables, 7 indexes
- Verified on SQLite 3.53.4 and PostgreSQL 19.0 (PGlite 0.6.1),
- 42 seed rows from the blueprint
- The blueprint's test build passed 21 of 21 acceptance checks
Equipment tracker entity-relationship diagram
Relationships
- items.type_id references item_types.id: each items row points to exactly one item_types row, and one item_types row can have many items rows pointing to it.
- items.holder_id references people.id: each items row points to at most one people row, and one people row can have many items rows pointing to it.
- assignments.item_id references items.id: each assignments row points to exactly one items row, and one items row can have many assignments rows pointing to it.
- assignments.person_id references people.id: each assignments row points to exactly one people row, and one people row can have many assignments rows pointing to it.
- assignments.checked_out_by references people.id: each assignments row points to exactly one people row, and one people row can have many assignments rows pointing to it.
- assignments.checked_in_by references people.id: each assignments row points to at most one people row, and one people row can have many assignments rows pointing to it.
- asset_checks.started_by references people.id: each asset_checks row points to exactly one people row, and one people row can have many asset_checks rows pointing to it.
- check_responses.check_id references asset_checks.id: each check_responses row points to exactly one asset_checks row, and one asset_checks row can have many check_responses rows pointing to it.
- check_responses.person_id references people.id: each check_responses row points to exactly one people row, and one people row can have many check_responses rows pointing to it.
- check_responses.item_id references items.id: each check_responses row points to exactly one items row, and one items row can have many check_responses rows pointing to it.
- events.item_id references items.id: each events row points to at most one items row, and one items 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.item_id references items.id: each notifications row points to at most one items row, and one items row can have many notifications rows pointing to it.
Equipment tracker tables
The schema has 9 tables. Every column below is read from the SQL file itself. Also described as: equipment tracking database design, laptop checkout database tables, asset register data model.
| Table | Implements | What a row is |
|---|---|---|
people | Person | A person who can sign in and hold items, with an IT admin flag. |
settings | Settings | The one row with the company name, IT email, time zone, warranty notice days and tag numbering. |
item_types | ItemType | A kind of item such as Laptop or Monitor; never deleted, only made inactive. |
items | Item | A tagged piece of equipment with its cost, warranty end, status and current holder. |
assignments | Assignment | One period an item was held by one person, with who checked it out and in and the condition. |
asset_checks | AssetCheck | A round of asking holders to confirm the items they have. |
check_responses | CheckResponse | One item to confirm in a check, with the holder's answer and note. |
events | Event | One append-only entry in an item's history, or a check's start or close. |
notifications | Notification | One email in the outbox with its status and last error. |
people
A person who can sign in and hold equipment. People are deactivated, never deleted.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
name | TEXT | no | |||
email | TEXT | no | Unique | stored lowercaseCheck: email = lower(email) | |
is_it_admin | BOOLEAN | no | FALSE | ||
active | BOOLEAN | no | TRUE |
- App rule (R3): a person who holds assigned items cannot be deactivated; nobody can deactivate the last active IT admin.
settings
The single settings row. id is fixed at 1 so the table can never hold a second row.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | INTEGER | no | Primary key | Check: id = 1 | |
company_name | TEXT | no | |||
it_email | TEXT | no | shown on the found-item page | ||
time_zone | TEXT | no | 'America/New_York' | IANA name; "today" and every date use this zone | |
email_domain | TEXT | yes | the company sign-in domain (section 3) | ||
warranty_notice_days | INTEGER | no | 30 | Check: warranty_notice_days BETWEEN 1 AND 365 | |
tag_prefix | TEXT | no | 'NW-' | app rule: letters, digits, ".", "-" or "_" onlyCheck: length(tag_prefix) BETWEEN 1 AND 10 | |
next_tag_number | INTEGER | no | 1 | read-only on SettingsCheck: next_tag_number >= 1 |
item_types
A kind of item (Laptop, Monitor...). Never deleted; an inactive type cannot be chosen for new or imported items.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
name | TEXT | no | Check: length(name) BETWEEN 1 AND 40 | ||
active | BOOLEAN | no | TRUE |
- Unique index
item_types_name_uniqueon(lower(name))
items
A piece of equipment with a permanent tag.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
tag | TEXT | no | Unique | e.g. NW-0042 | |
type_id | TEXT | no | References item_types.id | ||
make | TEXT | no | Check: length(make) BETWEEN 1 AND 60 | ||
model | TEXT | no | Check: length(model) BETWEEN 1 AND 80 | ||
serial_number | TEXT | yes | Check: length(serial_number) <= 80 | ||
purchase_date | DATE | yes | |||
cost_cents | INTEGER | yes | $0 to $100,000; NULL means cost unknownCheck: cost_cents BETWEEN 0 AND 10000000 | ||
supplier | TEXT | yes | Check: length(supplier) <= 80 | ||
warranty_end | DATE | yes | |||
status | TEXT | no | 'in_stock' | Check: status IN ('in_stock', 'assigned', 'in_repair', 'retired', 'lost') | |
holder_id | TEXT | yes | References people.id | set if and only if status is assigned (R2) | |
location | TEXT | yes | free text, e.g. "London office"Check: length(location) <= 80 | ||
notes | TEXT | yes | Check: length(notes) <= 1000 | ||
retire_reason | TEXT | yes | Check: length(retire_reason) BETWEEN 5 AND 200 | ||
created_at | TIMESTAMP | no | |||
version | INTEGER | no | 1 | Check: version >= 1 |
- Table check:
(status = 'assigned' AND holder_id IS NOT NULL) OR (status <> 'assigned' AND holder_id IS NULL) - Table check:
(status = 'retired' AND retire_reason IS NOT NULL) OR (status <> 'retired' AND retire_reason IS NULL) - Table check:
warranty_end IS NULL OR purchase_date IS NULL OR warranty_end >= purchase_date - Unique index
items_serial_uniqueon(lower(trim(serial_number)))wherestatus <> 'retired' AND serial_number IS NOT NULL. R4: a serial is unique among items that are not retired, compared trimmed and ignoring case. - Index
items_holderon(holder_id) - App rule (R1): tag is tag_prefix plus next_tag_number zero-padded to 4 digits, assigned at creation, never reused or changed.
- App rule (section 6): status changes only through the lifecycle actions; retired is final.
- App rule (R11): every IT action checks version first and adds 1 to it.
assignments
One period an item was held by one person. Open while checked_in_at is NULL.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
item_id | TEXT | no | References items.id | ||
person_id | TEXT | no | References people.id | ||
checked_out_at | TIMESTAMP | no | |||
checked_out_by | TEXT | no | References people.id | ||
condition_out | TEXT | yes | Check: length(condition_out) <= 200 | ||
checked_in_at | TIMESTAMP | yes | |||
checked_in_by | TEXT | yes | References people.id | ||
condition_in | TEXT | yes | the repair note when sent to repair; "Lost" when marked lostCheck: length(condition_in) <= 200 |
- Table check:
(checked_in_at IS NULL AND checked_in_by IS NULL) OR (checked_in_at IS NOT NULL AND checked_in_by IS NOT NULL) - Table check:
checked_in_at IS NULL OR checked_in_at >= checked_out_at - Unique index
assignments_one_openon(item_id)wherechecked_in_at IS NULL
asset_checks
A round of asking every holder to confirm the items they have (R10).
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
started_at | TIMESTAMP | no | |||
started_by | TEXT | no | References people.id | ||
due_date | DATE | no | the start date plus 7 days in the team time zone; also the reminder day | ||
closed_at | TIMESTAMP | yes |
- Unique index
asset_checks_one_openon((closed_at IS NULL))whereclosed_at IS NULL
check_responses
One item to confirm in a check, addressed to the person who held it when the check started.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
check_id | TEXT | no | References asset_checks.id | ||
person_id | TEXT | no | References people.id | ||
item_id | TEXT | no | References items.id | ||
answer | TEXT | no | 'pending' | Check: answer IN ('pending', 'have_it', 'dont_have_it') | |
note | TEXT | yes | optional with have_it; 5 to 300 characters with dont_have_itCheck: length(note) <= 300 | ||
answered_at | TIMESTAMP | yes | |||
reminded_at | TIMESTAMP | yes | when the one reminder for this check went to this person |
- Unique together:
check_id, item_id - Table check:
answer <> 'dont_have_it' OR length(note) >= 5 - Table check:
(answer = 'pending' AND answered_at IS NULL) OR (answer <> 'pending' AND answered_at IS NOT NULL) - App rule (R10): answers are final.
events
One thing that happened, mostly to an item. Append-only (R13).
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
item_id | TEXT | yes | References items.id | NULL for check_started and check_closed | |
actor_id | TEXT | yes | References people.id | NULL for the system | |
type | TEXT | no | Check: type IN ('created', 'edited', 'checked_out', 'checked_in', 'sent_to_repair', 'back_from_repair', 'retired', 'marked_lost', 'found', 'imported', 'problem_reported', 'check_started', 'check_answered', 'check_closed', 'warranty_reminded') | ||
data | TEXT | yes | JSON stored as text | ||
created_at | TIMESTAMP | no |
- Index
events_itemon(item_id, created_at)
notifications
One email in the outbox. Written first, then sent; a failure never blocks the action.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
kind | TEXT | no | |||
to_email | TEXT | no | |||
person_id | TEXT | yes | References people.id | ||
item_id | TEXT | yes | References items.id | ||
subject | TEXT | no | |||
body | TEXT | no | |||
status | TEXT | no | 'pending' | Check: status IN ('pending', 'sent', 'logged', 'failed') | |
error | TEXT | yes | the last error of a failed send | ||
created_at | TIMESTAMP | no | |||
sent_at | TIMESTAMP | yes |
- Table check:
status <> 'logged' OR sent_at IS NULL - Index
notifications_statuson(status)
The SQL
The whole schema in one file. It runs top to bottom, unmodified, on SQLite and PostgreSQL. Download equipment-tracker.sql or copy it from here.
-- Equipment Tracker database schema
-- Source: https://personalsoftwarefactory.com/blueprints/equipment-tracker (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 who can sign in and hold equipment. People are deactivated, never deleted.
-- App rule (R3): a person who holds assigned items cannot be deactivated; nobody can deactivate the last active IT admin.
CREATE TABLE people (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
email TEXT NOT NULL UNIQUE CHECK (email = lower(email)), -- stored lowercase
is_it_admin BOOLEAN NOT NULL DEFAULT FALSE,
active BOOLEAN NOT NULL DEFAULT TRUE
);
-- The single settings row. id is fixed at 1 so the table can never hold a second row.
CREATE TABLE settings (
id INTEGER PRIMARY KEY CHECK (id = 1),
company_name TEXT NOT NULL,
it_email TEXT NOT NULL, -- shown on the found-item page
time_zone TEXT NOT NULL DEFAULT 'America/New_York', -- IANA name; "today" and every date use this zone
email_domain TEXT, -- the company sign-in domain (section 3)
warranty_notice_days INTEGER NOT NULL DEFAULT 30 CHECK (warranty_notice_days BETWEEN 1 AND 365),
tag_prefix TEXT NOT NULL DEFAULT 'NW-' CHECK (length(tag_prefix) BETWEEN 1 AND 10), -- app rule: letters, digits, ".", "-" or "_" only
next_tag_number INTEGER NOT NULL DEFAULT 1 CHECK (next_tag_number >= 1) -- read-only on Settings
);
-- A kind of item (Laptop, Monitor...). Never deleted; an inactive type cannot be chosen for new or imported items.
CREATE TABLE item_types (
id TEXT PRIMARY KEY,
name TEXT NOT NULL CHECK (length(name) BETWEEN 1 AND 40),
active BOOLEAN NOT NULL DEFAULT TRUE
);
CREATE UNIQUE INDEX item_types_name_unique ON item_types (lower(name)); -- unique ignoring case
-- A piece of equipment with a permanent tag.
-- App rule (R1): tag is tag_prefix plus next_tag_number zero-padded to 4 digits, assigned at creation, never reused or changed.
-- App rule (section 6): status changes only through the lifecycle actions; retired is final.
-- App rule (R11): every IT action checks version first and adds 1 to it.
CREATE TABLE items (
id TEXT PRIMARY KEY,
tag TEXT NOT NULL UNIQUE, -- e.g. NW-0042
type_id TEXT NOT NULL REFERENCES item_types(id),
make TEXT NOT NULL CHECK (length(make) BETWEEN 1 AND 60),
model TEXT NOT NULL CHECK (length(model) BETWEEN 1 AND 80),
serial_number TEXT CHECK (length(serial_number) <= 80),
purchase_date DATE,
cost_cents INTEGER CHECK (cost_cents BETWEEN 0 AND 10000000), -- $0 to $100,000; NULL means cost unknown
supplier TEXT CHECK (length(supplier) <= 80),
warranty_end DATE,
status TEXT NOT NULL DEFAULT 'in_stock' CHECK (status IN ('in_stock', 'assigned', 'in_repair', 'retired', 'lost')),
holder_id TEXT REFERENCES people(id), -- set if and only if status is assigned (R2)
location TEXT CHECK (length(location) <= 80), -- free text, e.g. "London office"
notes TEXT CHECK (length(notes) <= 1000),
retire_reason TEXT CHECK (length(retire_reason) BETWEEN 5 AND 200),
created_at TIMESTAMP NOT NULL,
version INTEGER NOT NULL DEFAULT 1 CHECK (version >= 1),
CHECK ((status = 'assigned' AND holder_id IS NOT NULL) OR (status <> 'assigned' AND holder_id IS NULL)),
CHECK ((status = 'retired' AND retire_reason IS NOT NULL) OR (status <> 'retired' AND retire_reason IS NULL)),
CHECK (warranty_end IS NULL OR purchase_date IS NULL OR warranty_end >= purchase_date)
);
-- R4: a serial is unique among items that are not retired, compared trimmed and ignoring case.
CREATE UNIQUE INDEX items_serial_unique ON items (lower(trim(serial_number))) WHERE status <> 'retired' AND serial_number IS NOT NULL;
CREATE INDEX items_holder ON items (holder_id);
-- One period an item was held by one person. Open while checked_in_at is NULL.
CREATE TABLE assignments (
id TEXT PRIMARY KEY,
item_id TEXT NOT NULL REFERENCES items(id),
person_id TEXT NOT NULL REFERENCES people(id),
checked_out_at TIMESTAMP NOT NULL,
checked_out_by TEXT NOT NULL REFERENCES people(id),
condition_out TEXT CHECK (length(condition_out) <= 200),
checked_in_at TIMESTAMP,
checked_in_by TEXT REFERENCES people(id),
condition_in TEXT CHECK (length(condition_in) <= 200), -- the repair note when sent to repair; "Lost" when marked lost
CHECK ((checked_in_at IS NULL AND checked_in_by IS NULL) OR (checked_in_at IS NOT NULL AND checked_in_by IS NOT NULL)),
CHECK (checked_in_at IS NULL OR checked_in_at >= checked_out_at)
);
CREATE UNIQUE INDEX assignments_one_open ON assignments (item_id) WHERE checked_in_at IS NULL; -- at most one open assignment per item
-- A round of asking every holder to confirm the items they have (R10).
CREATE TABLE asset_checks (
id TEXT PRIMARY KEY,
started_at TIMESTAMP NOT NULL,
started_by TEXT NOT NULL REFERENCES people(id),
due_date DATE NOT NULL, -- the start date plus 7 days in the team time zone; also the reminder day
closed_at TIMESTAMP
);
CREATE UNIQUE INDEX asset_checks_one_open ON asset_checks ((closed_at IS NULL)) WHERE closed_at IS NULL; -- only one open check at a time
-- One item to confirm in a check, addressed to the person who held it when the check started.
-- App rule (R10): answers are final.
CREATE TABLE check_responses (
id TEXT PRIMARY KEY,
check_id TEXT NOT NULL REFERENCES asset_checks(id),
person_id TEXT NOT NULL REFERENCES people(id),
item_id TEXT NOT NULL REFERENCES items(id),
answer TEXT NOT NULL DEFAULT 'pending' CHECK (answer IN ('pending', 'have_it', 'dont_have_it')),
note TEXT CHECK (length(note) <= 300), -- optional with have_it; 5 to 300 characters with dont_have_it
answered_at TIMESTAMP,
reminded_at TIMESTAMP, -- when the one reminder for this check went to this person
UNIQUE (check_id, item_id),
CHECK (answer <> 'dont_have_it' OR length(note) >= 5),
CHECK ((answer = 'pending' AND answered_at IS NULL) OR (answer <> 'pending' AND answered_at IS NOT NULL))
);
-- One thing that happened, mostly to an item. Append-only (R13).
CREATE TABLE events (
id TEXT PRIMARY KEY,
item_id TEXT REFERENCES items(id), -- NULL for check_started and check_closed
actor_id TEXT REFERENCES people(id), -- NULL for the system
type TEXT NOT NULL CHECK (type IN ('created', 'edited', 'checked_out', 'checked_in', 'sent_to_repair', 'back_from_repair', 'retired', 'marked_lost', 'found', 'imported', 'problem_reported', 'check_started', 'check_answered', 'check_closed', 'warranty_reminded')),
data TEXT, -- JSON stored as text
created_at TIMESTAMP NOT NULL
);
CREATE INDEX events_item ON events (item_id, created_at);
-- One email in the outbox. Written first, then sent; a failure never blocks the action.
CREATE TABLE notifications (
id TEXT PRIMARY KEY,
kind TEXT NOT NULL,
to_email TEXT NOT NULL,
person_id TEXT REFERENCES people(id),
item_id TEXT REFERENCES items(id),
subject TEXT NOT NULL,
body TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'sent', 'logged', 'failed')),
error TEXT, -- the last error of a failed send
created_at TIMESTAMP NOT NULL,
sent_at TIMESTAMP,
CHECK (status <> 'logged' OR sent_at IS NULL) -- a logged email has no sent_at
);
CREATE INDEX notifications_status ON notifications (status);Seed data
Loads all of section 14 as of the spec's seed day, Tue 13 Oct 2026: settings, 7 people, 5 types, 8 items, 5 assignments and the 16 events the history implies (created for each item, 5 check-outs, NW-0006's check-in and repair, NW-0007's retirement), marked as seed data. The spec moves every date to the day you load it; this file uses the fixed dates. Times are 12:00 UTC because the spec gives dates only, created and retired events have no actor, and every item starts at version 1. No asset checks or emails exist in the seed.
Download equipment-tracker-seed.sql (42 rows). It loads with foreign keys enforced on both engines.
Load it
SQLite, into a new file:
curl -s https://personalsoftwarefactory.com/schemas/equipment-tracker.sql https://personalsoftwarefactory.com/schemas/equipment-tracker-seed.sql | sqlite3 equipment_tracker.dbPostgreSQL, into a new database:
createdb equipment_tracker && curl -s https://personalsoftwarefactory.com/schemas/equipment-tracker.sql https://personalsoftwarefactory.com/schemas/equipment-tracker-seed.sql | psql -v ON_ERROR_STOP=1 equipment_trackerSQLite only enforces foreign keys when the connection asks for it: run PRAGMA foreign_keys = ON; when your app opens the database.
Design decisions
Holder is set exactly when the item is assigned
R2 says an item has a holder exactly when its status is assigned, so a CHECK ties holder_id to status in both directions. Without it, an item in repair could keep a stale holder and still count toward that person's value in R9, or block their deactivation under R3.
Assignments are history rows, one open per item
From the build test · field report
Each period an item is held is its own row, closed with checked_in_at, checked_in_by and condition_in; a transfer is a check-in plus a check-out, so both show in the history (section 6). A partial unique index on item_id WHERE checked_in_at IS NULL allows at most one open assignment per item, as section 5 requires. The build test found that sending to repair from assigned didn't say what it records; the repair note is now the closed assignment's condition_in.
Serials are unique only among items not retired
From the build test · field report
R4 frees a serial when its item is retired, but a lost item keeps it. The build test found the spec didn't say whether serials compare ignoring case or what a lost item does; they compare trimmed and ignoring case, so the unique index is on lower(trim(serial_number)) WHERE status <> 'retired'.
Warranty state is computed, not stored
From the build test · field report
items stores only warranty_end; Expired, Ending soon and Covered (R7) depend on today and warranty_notice_days, so a stored state would be wrong the next morning. The build test found the end date itself was unclear: it is Ending soon, and the day after is Expired, which is what the query below uses.
Costs are optional integer cents
cost_cents is NULL when the cost is unknown and otherwise 0 to 10,000,000 (R6's $0 to $100,000). R9 counts unknown costs as $0 and lists them as cost unknown, which COALESCE does in the totals; storing 0 for unknown would hide which items need a cost.
One open asset check at a time
R10 allows only one open check. A unique index on the expression (closed_at IS NULL), limited to rows WHERE closed_at IS NULL, lets the database refuse a second open check while closed checks pile up freely. Each item appears once per check, addressed to the person who held it when the check started.
Example queries
The queries behind the tool's main screens. Each returned the same rows on both engines against the seed data.
Warranty state of every item in use
SELECT i.tag, i.model, i.status, i.warranty_end,
CASE
WHEN i.warranty_end IS NULL THEN 'No warranty date'
WHEN i.warranty_end < '2026-10-13' THEN 'Expired'
WHEN i.warranty_end <= '2026-11-12' THEN 'Ending soon'
ELSE 'Covered'
END AS warranty_state
FROM items i
WHERE i.status NOT IN ('retired', 'lost')
ORDER BY i.tag;On the seed data, with today as 2026-10-13 and a 30-day notice: 7 rows; NW-0001 is Ending soon (2026-11-02) and NW-0005 is Expired.
Company value
SELECT COUNT(*) AS items,
SUM(COALESCE(cost_cents, 0)) AS company_value_cents,
SUM(CASE WHEN cost_cents IS NULL THEN 1 ELSE 0 END) AS cost_unknown
FROM items
WHERE status NOT IN ('retired', 'lost');On the seed data: 1 row; 7 items worth 905,300 cents ($9,053), none with an unknown cost.
What each person holds
SELECT p.name, p.email, COUNT(i.id) AS items_held, SUM(COALESCE(i.cost_cents, 0)) AS value_cents
FROM people p
JOIN items i ON i.holder_id = p.id AND i.status = 'assigned'
GROUP BY p.name, p.email
ORDER BY p.name;On the seed data: 3 rows; Jo Park holds 2 items worth 167,800 cents ($1,678).
Assignments export
SELECT i.tag, i.make, i.model, p.name AS person_name, p.email AS person_email,
o.name AS checked_out_by, CASE WHEN a.checked_in_at IS NULL THEN 'open' ELSE 'closed' END AS state,
COALESCE(b.name, '') AS checked_in_by,
COALESCE(a.condition_in, '') AS condition_in
FROM assignments a
JOIN items i ON i.id = a.item_id
JOIN people p ON p.id = a.person_id
JOIN people o ON o.id = a.checked_out_by
LEFT JOIN people b ON b.id = a.checked_in_by
ORDER BY i.tag, a.checked_out_at;On the seed data: 5 rows; 4 open; the closed one is NW-0006, held by Maya Chen and checked in by Ben Cho with Keyboard not responding.
An item's event log
SELECT e.type, COALESCE(p.name, 'system') AS actor
FROM events e
JOIN items i ON i.id = e.item_id
LEFT JOIN people p ON p.id = e.actor_id
WHERE i.tag = 'NW-0006'
ORDER BY e.created_at, e.id;On the seed data, for NW-0006: 4 rows, from created by the system to sent_to_repair by Ben Cho.
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 Equipment Tracker blueprint, a free spec that also has the business rules, the screens, 4 phased build prompts and 21 acceptance checks for building the whole tool with an AI app builder. We built it from those prompts and the result passed 21 of 21 acceptance checks in a browser.
- Read the Equipment Tracker blueprint: rules, screens, build prompts and acceptance checks
- Read the build-test field report: what the test build got wrong and what was not tested
- All database schemas
- How we test blueprints
Follow new blueprints
Every new blueprint and build test appears in the feed and in the public GitHub repository. No account, no email list.