Visitor management system database schema
Eleven tables. visits carries the design: one row per sign-in, on site while signed_out_at is NULL, with an optional host, a unique invite link so an invite is used once, and an anonymized_at stamp for retention. Documents are versioned, and each signature references the exact document version through a composite foreign key, so the visit page can show the text that was signed. Visitors have no table of their own; a returning visitor is found by email in past visits and signatures.
- 11 tables, 5 indexes
- Verified on SQLite 3.53.4 and PostgreSQL 19.0 (PGlite 0.6.1),
- 32 seed rows from the blueprint
- The blueprint's test build passed 17 of 17 acceptance checks
Visitor sign-in entity-relationship diagram
Relationships
- document_versions.document_id references documents.id: each document_versions row points to exactly one documents row, and one documents row can have many document_versions rows pointing to it.
- visit_types.document_id references documents.id: each visit_types row points to at most one documents row, and one documents row can have many visit_types rows pointing to it.
- invites.host_id references people.id: each invites row points to exactly one people row, and one people row can have many invites rows pointing to it.
- invites.visit_type_id references visit_types.id: each invites row points to exactly one visit_types row, and one visit_types row can have many invites rows pointing to it.
- visits.visit_type_id references visit_types.id: each visits row points to exactly one visit_types row, and one visit_types row can have many visits rows pointing to it.
- visits.host_id references people.id: each visits row points to at most one people row, and one people row can have many visits rows pointing to it.
- visits.invite_id references invites.id: each visits row points to at most one invites row, and one invites row can have at most one visits row pointing to it.
- signatures.visit_id references visits.id: each signatures row points to exactly one visits row, and one visits row can have many signatures rows pointing to it.
- signatures.document_id, version references document_versions.document_id, version: each signatures row points to exactly one document_versions row, and one document_versions row can have many signatures rows pointing to it.
Visitor sign-in tables
The schema has 11 tables. Every column below is read from the SQL file itself. Also described as: visitor log database design, front desk sign-in database tables, office visitor check-in data model.
| Table | Implements | What a row is |
|---|---|---|
settings | Settings | The one row of office settings: name, time zone, retention, automatic sign-out time, notice and badge size. |
people | Person | A staff member or admin with an account, who can host visitors. |
devices | Device | A reception tablet that signs in with a secret token and can use only the kiosk. |
documents | Document | A document visitors sign, with its active version and re-sign interval. |
document_versions | DocumentVersion | One published, never edited version of a document's text. |
visit_types | VisitType | A kind of visit and what the kiosk asks for it: host, document, badge, company. |
invites | Invite | A visit arranged in advance, with a single-use code and a status. |
visits | Visit | One sign-in at the kiosk, open until it is signed out. |
signatures | Signature | One document version signed during one visit, with the typed name. |
events | Event | An append-only record of one change. |
notifications | Notification | One email in the outbox, with its delivery status. |
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 | |
office_name | TEXT | no | |||
address | TEXT | yes | |||
time_zone | TEXT | no | IANA name; invite dates, automatic sign-out and the export use this zone | ||
retention_days | INTEGER | no | 90 | visits signed out longer ago than this are anonymisedCheck: retention_days >= 1 | |
auto_sign_out_time | TEXT | no | '19:00' | HH:MM in the office time zoneCheck: length(auto_sign_out_time) = 5 AND substr(auto_sign_out_time, 3, 1) = ':' | |
privacy_notice | TEXT | yes | shown on the kiosk before Sign in | ||
reception_email | TEXT | yes | told about visits whose type needs no host | ||
badge_size | TEXT | no | '62 x 100 mm' | width x height of the label, used as the CSS page size | |
slack_webhook_url | TEXT | yes | optional; a secret, never shown back in full |
people
A staff member with an account.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
name | TEXT | no | |||
email | TEXT | no | Unique | stored lowercaseCheck: email = lower(email) | |
role | TEXT | no | Check: role IN ('admin', 'staff') | ||
active | BOOLEAN | no | TRUE |
devices
A reception tablet that signs in once with its token and can use only the kiosk.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
name | TEXT | no | |||
token | TEXT | no | Unique | long random secret; the kiosk opens /kiosk with it once | |
active | BOOLEAN | no | TRUE |
- App rule (R8): a device can create visits, use invites, sign visits out and make the few reads those need, nothing else.
documents
A document visitors sign, such as an NDA. Its text lives in document_versions.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
title | TEXT | no | |||
active_version | INTEGER | no | the version shown to sign. No foreign key: document_versions points back here (a cycle).Check: active_version >= 1 | ||
re_sign_after_days | INTEGER | no | a visitor who signed the active version within this many days is not asked againCheck: re_sign_after_days >= 0 |
document_versions
One published version of a document. Versions are never edited.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
document_id | TEXT | no | Primary key (part); References documents.id | ||
version | INTEGER | no | Primary key (part) | 1, 2, 3...Check: version >= 1 | |
body | TEXT | no | Markdown | ||
published_at | TIMESTAMP | no |
- App rule (R2): publishing an edit creates the next version and makes it active.
visit_types
A kind of visit (Guest, Interview, Contractor, Delivery) and what the kiosk asks for it.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
name | TEXT | no | |||
requires_host | BOOLEAN | no | |||
document_id | TEXT | yes | References documents.id | the document to sign, if any | |
prints_badge | BOOLEAN | no | |||
asks_company | BOOLEAN | no | the company field is shown; it is optional even then | ||
active | BOOLEAN | no | TRUE |
invites
A visit a staff member arranged in advance, with a code the visitor scans at the kiosk.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
visitor_name | TEXT | no | |||
visitor_email | TEXT | yes | required when inviting; cleared when anonymised | ||
company | TEXT | yes | |||
host_id | TEXT | no | References people.id | ||
visit_type_id | TEXT | no | References visit_types.id | ||
expected_at | TIMESTAMP | no | |||
code | TEXT | no | Unique | random; shown as a QR code in the invite email | |
status | TEXT | no | 'expected' | Check: status IN ('expected', 'arrived', 'cancelled', 'no_show') |
- Index
invites_hoston(host_id, expected_at) - App rule (R5): the code works once, on the expected date in the office time zone only.
- App rule (R7): invites older than retention_days are anonymised; the name becomes Visitor and personal fields are cleared.
visits
One visit: a person signed in at the kiosk, on site until signed out.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
visitor_name | TEXT | no | for a delivery, the driverCheck: length(visitor_name) BETWEEN 2 AND 80 | ||
visitor_email | TEXT | yes | optional, except when the visit comes from an invite | ||
company | TEXT | yes | for a delivery, the carrier | ||
visit_type_id | TEXT | no | References visit_types.id | ||
host_id | TEXT | yes | References people.id | NULL for types that need no host | |
invite_id | TEXT | yes | References invites.id; Unique | an invite is used at most once | |
signed_in_at | TIMESTAMP | no | |||
signed_out_at | TIMESTAMP | yes | NULL while on site; for automatic sign-out, auto_sign_out_time on the day of the visit | ||
sign_out_method | TEXT | yes | Check: sign_out_method IN ('kiosk', 'badge', 'host', 'admin', 'auto') | ||
badge_code | TEXT | yes | Unique | random; printed as a QR code on the badge | |
anonymized_at | TIMESTAMP | yes |
- Table check:
sign_out_method IS NULL OR signed_out_at IS NOT NULL - Table check:
signed_out_at IS NULL OR signed_out_at >= signed_in_at - Index
visits_on_siteon(signed_in_at)wheresigned_out_at IS NULL - Index
visits_hoston(host_id, signed_in_at) - Index
visits_emailon(visitor_email) - App rule (R1): a host is required when the visit type requires one; the email must be valid when given.
- App rule (section 13): signing in again with the same email signs the earlier open visit out with method kiosk.
- App rule (R7): visits signed out more than retention_days ago are anonymised: name becomes Visitor, email and company are cleared.
signatures
One document signed during one visit. Never edited or deleted; anonymising clears the typed name.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
visit_id | TEXT | no | References visits.id | ||
visitor_email | TEXT | yes | copied from the visit, for the R3 lookup | ||
document_id | TEXT | no | |||
version | INTEGER | no | |||
typed_name | TEXT | yes | cleared when anonymised | ||
signed_at | TIMESTAMP | no |
- Index
signatures_emailon(visitor_email, document_id, version) - App rule (section 6): typed_name must match the visitor name, ignoring case and extra spaces.
- App rule (R3): a visitor signs again unless they signed the active version within re_sign_after_days, looked up by email.
events
One change, written by every action. Append-only.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
at | TIMESTAMP | no | |||
actor | TEXT | no | a person id, a device id, or the job | ||
type | TEXT | no | e.g. visit_signed_in, visitor_details_deleted | ||
data | TEXT | yes | details as JSON text; a deletion records who and how many records, never the email |
- App rule (R10): events are never edited or deleted. A run that changes nothing writes no event.
notifications
One email in the outbox. Every email is written here first, then sent.
| Column | Type | Null | Default | Key | Notes |
|---|---|---|---|---|---|
id | TEXT | no | Primary key | ||
kind | TEXT | no | which trigger in section 10, e.g. visitor_arrived, invite_created | ||
to_email | TEXT | no | |||
subject | TEXT | no | |||
body | TEXT | no | |||
status | TEXT | no | 'queued' | logged when no email provider is configuredCheck: status IN ('queued', 'sent', 'failed', 'logged') | |
error | TEXT | yes |
- App rule (R7): outbox emails older than retention_days are blanked.
The SQL
The whole schema in one file. It runs top to bottom, unmodified, on SQLite and PostgreSQL. Download visitor-sign-in.sql or copy it from here.
-- Visitor Sign-In database schema
-- Source: https://personalsoftwarefactory.com/blueprints/visitor-sign-in (data model, section 5 of the blueprint)
-- Verified on SQLite 3.53.4 and PostgreSQL 19.0 (PGlite). All timestamps are UTC.
-- License: MIT. Free to copy and adapt.
-- The single settings row. id is fixed at 1 so the table can never hold a second row.
CREATE TABLE settings (
id INTEGER PRIMARY KEY CHECK (id = 1),
office_name TEXT NOT NULL,
address TEXT,
time_zone TEXT NOT NULL, -- IANA name; invite dates, automatic sign-out and the export use this zone
retention_days INTEGER NOT NULL DEFAULT 90 CHECK (retention_days >= 1), -- visits signed out longer ago than this are anonymised
auto_sign_out_time TEXT NOT NULL DEFAULT '19:00' CHECK (length(auto_sign_out_time) = 5 AND substr(auto_sign_out_time, 3, 1) = ':'), -- HH:MM in the office time zone
privacy_notice TEXT, -- shown on the kiosk before Sign in
reception_email TEXT, -- told about visits whose type needs no host
badge_size TEXT NOT NULL DEFAULT '62 x 100 mm', -- width x height of the label, used as the CSS page size
slack_webhook_url TEXT -- optional; a secret, never shown back in full
);
-- A staff member with an account.
CREATE TABLE people (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
email TEXT NOT NULL UNIQUE CHECK (email = lower(email)), -- stored lowercase
role TEXT NOT NULL CHECK (role IN ('admin', 'staff')),
active BOOLEAN NOT NULL DEFAULT TRUE
);
-- A reception tablet that signs in once with its token and can use only the kiosk.
-- App rule (R8): a device can create visits, use invites, sign visits out and make the few reads those need, nothing else.
CREATE TABLE devices (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
token TEXT NOT NULL UNIQUE, -- long random secret; the kiosk opens /kiosk with it once
active BOOLEAN NOT NULL DEFAULT TRUE
);
-- A document visitors sign, such as an NDA. Its text lives in document_versions.
CREATE TABLE documents (
id TEXT PRIMARY KEY,
title TEXT NOT NULL,
active_version INTEGER NOT NULL CHECK (active_version >= 1), -- the version shown to sign. No foreign key: document_versions points back here (a cycle).
re_sign_after_days INTEGER NOT NULL CHECK (re_sign_after_days >= 0) -- a visitor who signed the active version within this many days is not asked again
);
-- One published version of a document. Versions are never edited.
-- App rule (R2): publishing an edit creates the next version and makes it active.
CREATE TABLE document_versions (
document_id TEXT NOT NULL REFERENCES documents(id),
version INTEGER NOT NULL CHECK (version >= 1), -- 1, 2, 3...
body TEXT NOT NULL, -- Markdown
published_at TIMESTAMP NOT NULL,
PRIMARY KEY (document_id, version)
);
-- A kind of visit (Guest, Interview, Contractor, Delivery) and what the kiosk asks for it.
CREATE TABLE visit_types (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
requires_host BOOLEAN NOT NULL,
document_id TEXT REFERENCES documents(id), -- the document to sign, if any
prints_badge BOOLEAN NOT NULL,
asks_company BOOLEAN NOT NULL, -- the company field is shown; it is optional even then
active BOOLEAN NOT NULL DEFAULT TRUE
);
-- A visit a staff member arranged in advance, with a code the visitor scans at the kiosk.
-- App rule (R5): the code works once, on the expected date in the office time zone only.
-- App rule (R7): invites older than retention_days are anonymised; the name becomes Visitor and personal fields are cleared.
CREATE TABLE invites (
id TEXT PRIMARY KEY,
visitor_name TEXT NOT NULL,
visitor_email TEXT, -- required when inviting; cleared when anonymised
company TEXT,
host_id TEXT NOT NULL REFERENCES people(id),
visit_type_id TEXT NOT NULL REFERENCES visit_types(id),
expected_at TIMESTAMP NOT NULL,
code TEXT NOT NULL UNIQUE, -- random; shown as a QR code in the invite email
status TEXT NOT NULL DEFAULT 'expected' CHECK (status IN ('expected', 'arrived', 'cancelled', 'no_show'))
);
CREATE INDEX invites_host ON invites (host_id, expected_at);
-- One visit: a person signed in at the kiosk, on site until signed out.
-- App rule (R1): a host is required when the visit type requires one; the email must be valid when given.
-- App rule (section 13): signing in again with the same email signs the earlier open visit out with method kiosk.
-- App rule (R7): visits signed out more than retention_days ago are anonymised: name becomes Visitor, email and company are cleared.
CREATE TABLE visits (
id TEXT PRIMARY KEY,
visitor_name TEXT NOT NULL CHECK (length(visitor_name) BETWEEN 2 AND 80), -- for a delivery, the driver
visitor_email TEXT, -- optional, except when the visit comes from an invite
company TEXT, -- for a delivery, the carrier
visit_type_id TEXT NOT NULL REFERENCES visit_types(id),
host_id TEXT REFERENCES people(id), -- NULL for types that need no host
invite_id TEXT UNIQUE REFERENCES invites(id), -- an invite is used at most once
signed_in_at TIMESTAMP NOT NULL,
signed_out_at TIMESTAMP, -- NULL while on site; for automatic sign-out, auto_sign_out_time on the day of the visit
sign_out_method TEXT CHECK (sign_out_method IN ('kiosk', 'badge', 'host', 'admin', 'auto')),
badge_code TEXT UNIQUE, -- random; printed as a QR code on the badge
anonymized_at TIMESTAMP,
CHECK (sign_out_method IS NULL OR signed_out_at IS NOT NULL),
CHECK (signed_out_at IS NULL OR signed_out_at >= signed_in_at)
);
CREATE INDEX visits_on_site ON visits (signed_in_at) WHERE signed_out_at IS NULL;
CREATE INDEX visits_host ON visits (host_id, signed_in_at);
CREATE INDEX visits_email ON visits (visitor_email);
-- One document signed during one visit. Never edited or deleted; anonymising clears the typed name.
-- App rule (section 6): typed_name must match the visitor name, ignoring case and extra spaces.
-- App rule (R3): a visitor signs again unless they signed the active version within re_sign_after_days, looked up by email.
CREATE TABLE signatures (
id TEXT PRIMARY KEY,
visit_id TEXT NOT NULL REFERENCES visits(id),
visitor_email TEXT, -- copied from the visit, for the R3 lookup
document_id TEXT NOT NULL,
version INTEGER NOT NULL,
typed_name TEXT, -- cleared when anonymised
signed_at TIMESTAMP NOT NULL,
FOREIGN KEY (document_id, version) REFERENCES document_versions(document_id, version)
);
CREATE INDEX signatures_email ON signatures (visitor_email, document_id, version);
-- One change, written by every action. Append-only.
-- App rule (R10): events are never edited or deleted. A run that changes nothing writes no event.
CREATE TABLE events (
id TEXT PRIMARY KEY,
at TIMESTAMP NOT NULL,
actor TEXT NOT NULL, -- a person id, a device id, or the job
type TEXT NOT NULL, -- e.g. visit_signed_in, visitor_details_deleted
data TEXT -- details as JSON text; a deletion records who and how many records, never the email
);
-- One email in the outbox. Every email is written here first, then sent.
-- App rule (R7): outbox emails older than retention_days are blanked.
CREATE TABLE notifications (
id TEXT PRIMARY KEY,
kind TEXT NOT NULL, -- which trigger in section 10, e.g. visitor_arrived, invite_created
to_email TEXT NOT NULL,
subject TEXT NOT NULL,
body TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'queued' CHECK (status IN ('queued', 'sent', 'failed', 'logged')), -- logged when no email provider is configured
error TEXT
);Seed data
Loads section 14 as of Thursday 2026-10-15 in Chicago time: settings, 4 staff, the Reception iPad, 2 documents with 3 versions, 4 visit types, 3 invites, 8 visits (today, yesterday, 91 and 89 days ago) and the 6 signatures they imply. Local times are converted to UTC (Chicago is UTC-5 on those dates). Placeholders: the device token, invite and badge codes, and the document texts, which the spec does not give (it says only that version 2 adds a two-year term). Typed names are the visitor names, as section 6 requires; signatures other than Ana Ruiz at 09:13 use the sign-in time. Left out: the privacy notice text, the sign-out method for Sam Ortiz and Priya Shah, and the three invite emails in the outbox, because the spec gives their subjects but not their bodies. No events are seeded.
Download visitor-sign-in-seed.sql (32 rows). It loads with foreign keys enforced on both engines.
Load it
SQLite, into a new file:
curl -s https://personalsoftwarefactory.com/schemas/visitor-sign-in.sql https://personalsoftwarefactory.com/schemas/visitor-sign-in-seed.sql | sqlite3 visitor_sign_in.dbPostgreSQL, into a new database:
createdb visitor_sign_in && curl -s https://personalsoftwarefactory.com/schemas/visitor-sign-in.sql https://personalsoftwarefactory.com/schemas/visitor-sign-in-seed.sql | psql -v ON_ERROR_STOP=1 visitor_sign_inSQLite only enforces foreign keys when the connection asks for it: run PRAGMA foreign_keys = ON; when your app opens the database.
Design decisions
Signatures point at the exact document version
From the build test · field report
R2 says the visit page shows exactly the text that was signed and versions are never edited. document_versions is keyed on document_id and version, and signatures reference that pair with a composite foreign key, so a signature can never name a version that does not exist. The build test found the seed's NDA versions had no dates or text to tell them apart; version 1 is dated 400 days ago and version 2 200 days ago, and their texts differ.
The active version has no foreign key
documents.active_version names a row in document_versions, which in turn references documents, a cycle. The foreign key is kept on document_versions and active_version is a plain integer CHECKed to be at least 1; publishing a version and pointing active_version at it happen together in the app (R2).
Personal fields are nullable so retention can clear them
From the build test · field report
R7 anonymises visits, signatures and invites after retention_days: the name becomes Visitor and email, company and typed names are cleared, while the date, type and host stay for counts. So visitor_email, company and typed_name are nullable even where the kiosk asks for them, and visits.anonymized_at records when it happened. The build test found R7 left invites and outbox emails holding names and emails; they are now anonymised or blanked the same night, which is why invites.visitor_email is nullable too.
One visit per invite, signed out once
From the build test · field report
R5 makes an invite code work once, so visits.invite_id is UNIQUE. R6 allows one sign-out per visit with a method; a CHECK allows sign_out_method only with signed_out_at and requires signed_out_at to be after signed_in_at. The build test found automatic sign-out did not say which time it records; it is auto_sign_out_time on the day of the visit, so Carl Weber's visit ends at 19:00 Chicago time, 00:00 UTC.
Who is on site is a partial index
From the build test · field report
On site now and the Evacuation list are the visits with signed_out_at NULL, so a partial index covers exactly those rows. The build test found that deleting the details of a visitor still on site could drop them from the head count; such a visit is anonymised but stays on site as Visitor with its host and sign-in time, which the schema allows because anonymising never touches signed_out_at.
Host is required by the type, checked in the app
From the build test · field report
R1 requires a host only when the visit type requires one, so visits.host_id is nullable and the rule spans two tables. It stays an app rule, as does the typed name matching the visitor name ignoring case and extra spaces, which the build test added because the spec had not said the two must match.
Example queries
The queries behind the tool's main screens. Each returned the same rows on both engines against the seed data.
On site now
SELECT v.visitor_name, COALESCE(v.company, '') AS company, t.name AS visit_type,
COALESCE(p.name, 'Reception') AS host, v.signed_in_at
FROM visits v
JOIN visit_types t ON t.id = v.visit_type_id
LEFT JOIN people p ON p.id = v.host_id
WHERE v.signed_out_at IS NULL
ORDER BY v.signed_in_at;On the seed data: 2 rows; Omar Haddad of Brightwire Electrical, host Kim Olsen, signed in at 13:30 UTC (08:30 Chicago), then Ana Ruiz.
Visitor log for one host, last 7 days
SELECT v.signed_in_at, v.visitor_name, COALESCE(v.company, '') AS company, t.name AS visit_type,
COALESCE(v.sign_out_method, '') AS sign_out_method
FROM visits v
JOIN visit_types t ON t.id = v.visit_type_id
WHERE v.host_id = 'person_raj' AND v.signed_in_at >= '2026-10-09 05:00:00'
ORDER BY v.signed_in_at DESC;On the seed data, for Raj Patel from Oct 9 to Oct 15 in Chicago time: 2 rows; Ana Ruiz today, then Leo Grant yesterday, signed out at the kiosk.
Does a returning visitor need to sign again
SELECT d.title, s.version, s.signed_at
FROM signatures s
JOIN documents d ON d.id = s.document_id AND s.version = d.active_version
WHERE s.visitor_email = 'ana@bluebird.example' AND d.id = 'doc_nda'
AND s.signed_at >= '2025-10-15 05:00:00'
ORDER BY s.signed_at DESC;On the seed data, for ana@bluebird.example and 365 days back: 1 row, Mutual NDA version 2 signed today, so she is not asked to sign again.
Visits due for anonymising tonight
SELECT v.visitor_name, v.visitor_email, v.company, v.signed_out_at
FROM visits v
WHERE v.anonymized_at IS NULL AND v.signed_out_at < '2026-07-17 05:00:00'
ORDER BY v.signed_out_at;On the seed data, with 90 days of retention: 1 row, Sam Ortiz from 91 days ago; Priya Shah from 89 days ago stays.
Export: visits on one day with documents signed
SELECT v.signed_in_at, v.signed_out_at, COALESCE(v.sign_out_method, '') AS method,
v.visitor_name, COALESCE(v.company, '') AS company, COALESCE(v.visitor_email, '') AS email,
t.name AS visit_type, COALESCE(p.name, '') AS host,
COALESCE((SELECT d.title || ' v' || s.version FROM signatures s JOIN documents d ON d.id = s.document_id WHERE s.visit_id = v.id), '') AS signed
FROM visits v
JOIN visit_types t ON t.id = v.visit_type_id
LEFT JOIN people p ON p.id = v.host_id
WHERE v.signed_in_at >= '2026-10-14 05:00:00' AND v.signed_in_at < '2026-10-15 05:00:00'
ORDER BY v.signed_in_at;On the seed data, for Oct 14 in Chicago time: 3 rows; Leo Grant signed Mutual NDA v2, Nina Brooks was signed out by her host, Carl Weber was signed out automatically.
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 Visitor Sign-In blueprint, a free spec that also has the business rules, the screens, 4 phased build prompts and 17 acceptance checks for building the whole tool with an AI app builder. We built it from those prompts and the result passed 17 of 17 acceptance checks in a browser.
- Read the Visitor Sign-In 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.