decision control
Reference

Data model

Tables and columns, snake_case in the database, camelCase in the code.

Decision Control uses PostgreSQL as its database engine and Prisma as its access layer. The entire data model lives in a single file (apps/api/prisma/schema.prisma).

Conventions

  • id — every row uses a cuid (text), not an auto-incrementing number.
  • Dates — created_at and updated_at are automatic.
  • Names — tables and columns are in snake_case in the database (project_id); the code uses camelCase (projectId). Prisma translates.
  • Cascade delete — when a workspace or a project is deleted, everything that depends on it goes too (onDelete: Cascade), except where stated otherwise.

Soft delete and archive

Deleting is logical for the assets people author and for the tenancy hierarchy. Those rows carry a deleted_at timestamp (decisions, decision_tables, datasets, projects, workspaces) and stay in the database; every read filters them out. projects and workspaces also carry archived_at, which retires them without deleting anything.

A key or slug is still unique, so a deleted row is renamed on the way out (loan-approval becomes loan-approval__deleted__<stamp>): the original key is free for reuse and the lookup keeps its simple unique shape. Restoring renames it back, and is refused with a conflict if the key was taken again.

Enums

These are stored as text with a fixed value.

EnumValuesWhat they are for
version_statusDRAFT, PUBLISHED, ARCHIVEDDecision / table version state.
outbox_statusPENDING, SENT, FAILEDDelivery state.
execution_statusSUCCESS, FAILEDOverall result.
execution_sourceAPI, SIMULATEWhere the execution came from.
workspace_roleOWNER, ADMIN, MEMBERWorkspace role.
member_role (formerly project_role)OWNER, ADMIN, EDITOR, VIEWERProject role.
invitation_statusPENDING, ACCEPTED, REVOKED, EXPIREDInvitation state.
case_kindALERT, REVIEWWhich action opened a case.
case_statusOPEN, IN_PROGRESS, RESOLVEDWorking state.
case_severityLOW, MEDIUM, HIGH, CRITICALSeverity the case was born with.
case_resolutionAPPROVED, REJECTED, CONFIRMED, FALSE_POSITIVE, NO_ACTIONAnalyst's verdict.

Identity and access

TableNotable columns
usersemail (unique), name, password_hash (argon2id in Bun, scrypt in tests), email_verified_at.
sessionsuser_id (FK, cascade), token_hash, expires_at, last_used_at. One row per active session — sign-out deletes it.
workspacesslug (readable, unique), name.
workspace_membershipsworkspace_id, user_id, role. Unique (workspace_id, user_id).
project_membershipsproject_id, user_id, role. Unique (project_id, user_id). Access is opt-in: only members see a project.
invitationsworkspace_id, project_id, email, role, token, status, invited_by_id, expires_at, accepted_at. Unique (project_id, email).

Project configuration

TableNotable columns
projectsworkspace_id (FK), key (unique per workspace), name, execution_retention_days (null follows the platform default; 0 keeps for ever).
api_keysproject_id, name, prefix (lookup), key_hash, scopes (text list, see API limits for the manage scope), last_used_at, disabled_at.
credentialsproject_id, name (unique), type, secret_ciphertext, iv, auth_tag. Encrypted at rest (AES-256-GCM).
global_variablesproject_id, name (unique), description, type, value (JSON). Read in expressions as global.<name>. Pinned at publish.
connectionsproject_id, name, kind, secret_ciphertext, iv, auth_tag. Encrypted like credentials; summary (host, region) shown.
webhooksproject_id, url, events (text list), secret_ciphertext, iv, auth_tag. Secret encrypted.

Decisions and decision tables

The same pattern repeats: a container with an editable draft and an immutable list of versions.

TableNotable columns
decisionsproject_id, key (unique per project), name, description, revision (optimistic concurrency), draft (JSON graph).
decision_versionsdecision_id, version (unique per decision), status, label (e.g. stable), changelog, input_schema, output_schema, graph, refs (pinned tables / sub-decisions), published_by, published_at.
decision_tablesproject_id, key, name, description, revision, draft (JSON table definition).
decision_table_versionstable_id, version, status, label, changelog, definition (rows, columns, hit policy, defaults).

Tags

TableNotable columns
tagsproject_id, name (unique per project), color (one of neutral, blue, green, amber, red, violet — a theme token).
decision_tagsdecision_id, tag_id. A decision carries many tags and a tag groups many decisions; deleting either side drops only the link.

Test cases

TableNotable columns
decision_test_casesdecision_id, name, input (JSON), expected_status, expected_decision, expected_outputs (JSON), expected_actions (text list), expected_error_code, mocks (JSON — now, http).

Datasets

TableNotable columns
datasetsproject_id, key (unique per project), name, description.
dataset_versionsdataset_id, version, definition (rows), published_at. Immutable.

Environments and deployments

TableNotable columns
environmentsproject_id, key (unique per project: development, staging, production), is_protected.
deploymentsproject_id, decision_id, environment_id, version, deployed_by, deployed_at.
experimentsproject_id, decision_id, environment_id, mode (split/shadow), challenger_version, routing_field.
environment_follows_latestenvironment_id, decision_id — when true, the environment runs whatever version is published.

Publish requests (four-eyes)

TableNotable columns
publish_requestsdecision_id, requested_by, status, requested_at, changelog, frozen_draft (the draft the approver publishes).
publish_request_actionsrequest_id, actor_id, action (requested/approved/rejected/cancelled), comment, actor_name, created_at.

Execution

TableNotable columns
executionspublic_id (DEC-XXXX), decision_id, decision_version_id (null for simulated drafts), version, status, source (API/SIMULATE), input, output, variables, reasons, actions, error, duration_ms, api_key_id (set null on delete), external_id (the caller's own reference), chain_seq, chain_hash, erased_at (set when a data-subject erasure emptied the content). Append-only apart from erasure.
action_outboxexecution_id, kind, label, target, payload, status, attempts, max_attempts, next_attempt_at, last_error, sent_at. Written in the same transaction as the execution.
execution_tracesexecution_public_id (PK, FK to executions.public_id, cascade), trace (JSON). The step-by-step trace, kept apart because it is the largest field a run writes and no list reads it.

Rollups

TableNotable columns
execution_rollupsproject_id, decision_key, bucket (hour), total, failed, duration_buckets (histogram), max_duration_ms, last_execution_at. Dashboard history; outlives the executions it summarises.
execution_outcome_rollupsdecision_id, environment_key, version, outcome, bucket (hour), total, first_at. What monitoring and drift read instead of scanning executions.
rollup_state, outcome_rollup_stateA single row each: up to which hour the matching rollups are final.

Audit

TableNotable columns
audit_logsactor (user:email, api-key:<name> or seed), workspace_id, project_id (loose references, not FKs), entity_type, entity_id, action, diff (JSON), created_at. Draft saves are not audited.

Cases (the inbox behind createAlert and enqueueReview)

TableNotable columns
casespublic_id (CASE-XXXX), execution_id (FK, cascade), decision_key, version, environment_key, kind, status, severity, title, subject, payload, assignee_id, resolution, resolution_note, resolved_by, resolved_at. Born from live executions (never simulations, never shadow).
case_eventscase_id (FK, cascade), type (opened/comment/assigned/status/severity/resolved/reopened), actor_id (nullable, system or user), actor_name (kept), body, data, created_at.

Features (feature store)

TableNotable columns
featuresproject_id, name, description. Series registry — observation rows can exist before it.
observationsproject_id, series, entity, value (numeric), attributes (JSON), occurred_at, execution_id. One row per event.

Relationships

  • A workspace has many projects and memberships.
  • A project has decisions, tables, datasets, api_keys, credentials, connections, webhooks, global_variables, environments, experiments, executions, audit logs, cases, features, tags and memberships.
  • A decision has many versions and many executions, and can carry many tags through decision_tags.
  • A decision_table has many decision_table_versions.
  • A dataset has many dataset_versions.
  • An execution can generate several action_outbox rows and several cases.
  • A case has many case_events (its timeline).
  • A publish_request can produce a version when approved.

The full schema is the authoritative source — see apps/api/prisma/schema.prisma in the repo.

On this page