IF Commons GitHub

controlRun

concept

What one run of a control found and when, with the evidence of it: a row of the history of a control, only added to

Model contract. Written in commons/data/models/contract/mod.ts:122. Identified by controlRunId.

Governance: attributes

controlRunIdidentifierrequired

What identifies the run

Becomes the column control_run_id of control_run.

Written at commons/data/models/contract/mod.ts:122

evidencetextoptional

Where the evidence is kept

Becomes the column evidence of control_run.

Written at commons/data/models/contract/mod.ts:122

ranAtinstantrequired

When

Becomes the column ran_at of control_run.

Written at commons/data/models/contract/mod.ts:122

resultcode of controlResultrequired

What it found

Becomes the column result of control_run.

Written at commons/data/models/contract/mod.ts:122

Governance: relationships

controlone

The control that was run To control. Written at commons/data/models/contract/mod.ts:122

Logical: the table

Projects to the table control_run with the primary key control_run_id.

ColumnTypeNullRoleFrom
control_idtextfalsereferencecontrolRun.control
control_run_idtextfalseattributecontrolRun.controlRunId
evidencetexttrueattributecontrolRun.evidence
ran_attimestampfalseattributecontrolRun.ranAt
resulttextfalseattributecontrolRun.result

Physical: SQL

CREATE TABLE IF NOT EXISTS "control_run" (
    "control_run_id" VARCHAR NOT NULL PRIMARY KEY,
    "result" VARCHAR NOT NULL,
    "ran_at" TIMESTAMPTZ NOT NULL,
    "evidence" VARCHAR,
    "control_id" VARCHAR NOT NULL,
    CONSTRAINT "control_run_control_id_fk" FOREIGN KEY ("control_id") REFERENCES "control" ("control_id"),
    CONSTRAINT "control_run_result_ck" CHECK ("result" IN ('pass', 'fail', 'waived', 'not_run'))
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { controlRun } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/contract.auto.ts: do not edit.

import { from } from "@intellectual-frontiers/data/sql/typed";
import { controlRun } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(controlRun).select((s) => ({ controlRunId: s.controlRun.controlRunId, result: s.controlRun.result })).run(runner);

Titles, headings, exports, tables, columns and requirements. Esc closes.