controlRunIdidentifierrequiredWhat identifies the run
Becomes the column control_run_id of control_run.
Written at commons/data/models/contract/mod.ts:122
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.
controlRunIdidentifierrequiredWhat identifies the run
Becomes the column control_run_id of control_run.
Written at commons/data/models/contract/mod.ts:122
evidencetextoptionalWhere the evidence is kept
Becomes the column evidence of control_run.
Written at commons/data/models/contract/mod.ts:122
ranAtinstantrequiredresultcode of controlResultrequiredWhat it found
Becomes the column result of control_run.
Written at commons/data/models/contract/mod.ts:122
controloneThe control that was run To control. Written at commons/data/models/contract/mod.ts:122
Projects to the table control_run with the primary key control_run_id.
| Column | Type | Null | Role | From |
|---|---|---|---|---|
control_id | text | false | reference | controlRun.control |
control_run_id | text | false | attribute | controlRun.controlRunId |
evidence | text | true | attribute | controlRun.evidence |
ran_at | timestamp | false | attribute | controlRun.ranAt |
result | text | false | attribute | controlRun.result |
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'))
);CREATE TABLE IF NOT EXISTS "control_run" (
"control_run_id" TEXT NOT NULL PRIMARY KEY,
"result" TEXT NOT NULL,
"ran_at" TIMESTAMPTZ NOT NULL,
"evidence" TEXT,
"control_id" TEXT 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'))
);CREATE TABLE IF NOT EXISTS "control_run" (
"control_run_id" TEXT NOT NULL PRIMARY KEY,
"result" TEXT NOT NULL,
"ran_at" TEXT NOT NULL,
"evidence" TEXT,
"control_id" TEXT 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'))
);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);