Data model
The tables of the Cases server.
The server keeps everything in one Postgres schema, cases, on any Postgres 14+. It creates the schema on its first start and applies its migrations there (recorded in cases.migrations); its database role owns the tables and needs no superuser.
| Table | Holds |
|---|---|
people | everyone who signed in: their id, e-mail and name |
workspaces, members, reviewers, invitations | who belongs where and their role (owner, editor, approver), the reviewers invited to a workspace, and invitations by e-mail not accepted; a workspace maps to a Sypnia organization in Sypnia Cloud |
maps | a map, its connected repository, its linked Data and Telemetry projects, and how many approvals a proposal needs |
versions | every approved version: number (unique per map), the proposal it came from, who proposed and approved, when, summary, and that version’s map.yaml and navigation.yaml, with the text of each file as it was written (map_text, navigation_text) |
version_cases | the full body of every case in a version, with its area, so any version can be read without replaying history; and, for a version made from files, the file’s text as written (text), so cases pull and the export give it back byte for byte. A case a proposal changed has no text and is written in the format’s compact style |
proposals, proposal_changes, proposal_reviewers | drafts, open and past proposals, the changes in each, in order, and the reviewers named on each |
approvals, comments | approvals per proposal (with the approver’s role), and comments per proposal, case or field |
check_results | the last check per map and version, with the code side it compared |
project_tokens | the Cases project tokens: name, scopes, expiry, the SHA-256 of the token and its last 4 characters |
links | each map’s links to Data, Telemetry and its repository; a token of another product is kept encrypted |
mail_outbox | review e-mails waiting to be sent, with their retries |
audit | every change: who, what, when |
Case bodies, map.yaml and navigation.yaml are stored as json, not jsonb: jsonb reorders the keys of an object, and the order people wrote outcomes and fields in is part of the file. Findings, details and settings are jsonb.
The runtime’s tables are not here: subscriptions, outbox, deliveries and processed_events live in the schema sypnia_cases of your app’s database, next to the data they describe (Delivery).
Versions are immutable: a trigger refuses every UPDATE and DELETE on versions, version_cases and audit, so they only grow. The API checks the caller’s role and the token’s scopes on every request, and checks the role again inside an approval’s transaction (Security). The map’s files in a repository are a projection of a version, never the other way round: a change in the files becomes a proposal first.