approvedAtinstantoptionalWhen it was approved
Becomes the column approved_at of mapping.
Written at commons/data/models/meaning/mod.ts:82
A source system's value mapped to the canonical value, with how the two relate, the rule it follows, who approved it and the dates between which it holds
Model meaning. Written in commons/data/models/meaning/mod.ts:69. Identified by mappingId.
approvedAtinstantoptionalWhen it was approved
Becomes the column approved_at of mapping.
Written at commons/data/models/meaning/mod.ts:82
approvedBytextoptionalWho approved it
Becomes the column approved_by of mapping.
Written at commons/data/models/meaning/mod.ts:81
mappingIdidentifierrequiredWhat identifies the mapping
Becomes the column mapping_id of mapping.
Written at commons/data/models/meaning/mod.ts:72
relationshipTypecode of relationshipTyperequiredHow the two relate
Becomes the column relationship_type of mapping.
Written at commons/data/models/meaning/mod.ts:78
ruletextoptionalThe rule it follows, where it is more than a lookup
Becomes the column rule of mapping.
Written at commons/data/models/meaning/mod.ts:79
sourceFieldtextrequiredThe field the value is of
Becomes the column source_field of mapping.
Written at commons/data/models/meaning/mod.ts:74
sourceSystemtextrequiredThe system the value is from
Becomes the column source_system of mapping.
Written at commons/data/models/meaning/mod.ts:73
sourceValuetextrequiredThe value as the source gives it
Becomes the column source_value of mapping.
Written at commons/data/models/meaning/mod.ts:75
statuscode of mappingStatusrequiredWhere it is in its approval
Becomes the column status of mapping.
Written at commons/data/models/meaning/mod.ts:80
targetFieldtextrequiredThe canonical field
Becomes the column target_field of mapping.
Written at commons/data/models/meaning/mod.ts:76
targetValuetextoptionalThe canonical value; none where the relationship is unmapped
Becomes the column target_value of mapping.
Written at commons/data/models/meaning/mod.ts:77
validFrominstantrequiredFrom when it holds
Becomes the column valid_from of mapping.
Written at commons/data/models/meaning/mod.ts:83
validToinstantoptionalUntil when it holds, where it ends
Becomes the column valid_to of mapping.
Written at commons/data/models/meaning/mod.ts:84
Projects to the table mapping with the primary key mapping_id.
| Column | Type | Null | Role | From |
|---|---|---|---|---|
approved_at | timestamp | true | attribute | mapping.approvedAt |
approved_by | text | true | attribute | mapping.approvedBy |
mapping_id | text | false | attribute | mapping.mappingId |
relationship_type | text | false | attribute | mapping.relationshipType |
rule | text | true | attribute | mapping.rule |
source_field | text | false | attribute | mapping.sourceField |
source_system | text | false | attribute | mapping.sourceSystem |
source_value | text | false | attribute | mapping.sourceValue |
status | text | false | attribute | mapping.status |
target_field | text | false | attribute | mapping.targetField |
target_value | text | true | attribute | mapping.targetValue |
valid_from | timestamp | false | attribute | mapping.validFrom |
valid_to | timestamp | true | attribute | mapping.validTo |
CREATE TABLE IF NOT EXISTS "mapping" (
"mapping_id" VARCHAR NOT NULL PRIMARY KEY,
"source_system" VARCHAR NOT NULL,
"source_field" VARCHAR NOT NULL,
"source_value" VARCHAR NOT NULL,
"target_field" VARCHAR NOT NULL,
"target_value" VARCHAR,
"relationship_type" VARCHAR NOT NULL,
"rule" VARCHAR,
"status" VARCHAR NOT NULL,
"approved_by" VARCHAR,
"approved_at" TIMESTAMPTZ,
"valid_from" TIMESTAMPTZ NOT NULL,
"valid_to" TIMESTAMPTZ,
CONSTRAINT "mapping_relationship_type_ck" CHECK ("relationship_type" IN ('equivalent', 'broader', 'narrower', 'related', 'unmapped')),
CONSTRAINT "mapping_status_ck" CHECK ("status" IN ('draft', 'approved', 'retired'))
);CREATE TABLE IF NOT EXISTS "mapping" (
"mapping_id" TEXT NOT NULL PRIMARY KEY,
"source_system" TEXT NOT NULL,
"source_field" TEXT NOT NULL,
"source_value" TEXT NOT NULL,
"target_field" TEXT NOT NULL,
"target_value" TEXT,
"relationship_type" TEXT NOT NULL,
"rule" TEXT,
"status" TEXT NOT NULL,
"approved_by" TEXT,
"approved_at" TIMESTAMPTZ,
"valid_from" TIMESTAMPTZ NOT NULL,
"valid_to" TIMESTAMPTZ,
CONSTRAINT "mapping_relationship_type_ck" CHECK ("relationship_type" IN ('equivalent', 'broader', 'narrower', 'related', 'unmapped')),
CONSTRAINT "mapping_status_ck" CHECK ("status" IN ('draft', 'approved', 'retired'))
);CREATE TABLE IF NOT EXISTS "mapping" (
"mapping_id" TEXT NOT NULL PRIMARY KEY,
"source_system" TEXT NOT NULL,
"source_field" TEXT NOT NULL,
"source_value" TEXT NOT NULL,
"target_field" TEXT NOT NULL,
"target_value" TEXT,
"relationship_type" TEXT NOT NULL,
"rule" TEXT,
"status" TEXT NOT NULL,
"approved_by" TEXT,
"approved_at" TEXT,
"valid_from" TEXT NOT NULL,
"valid_to" TEXT,
CONSTRAINT "mapping_relationship_type_ck" CHECK ("relationship_type" IN ('equivalent', 'broader', 'narrower', 'related', 'unmapped')),
CONSTRAINT "mapping_status_ck" CHECK ("status" IN ('draft', 'approved', 'retired'))
);Read and written from TypeScript with the types the model gives: import { mapping } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/meaning.auto.ts: do not edit.
import { from } from "@intellectual-frontiers/data/sql/typed";
import { mapping } from "@intellectual-frontiers/data/sql/typed/models";
const rows = await from(mapping).select((s) => ({ mappingId: s.mapping.mappingId, sourceSystem: s.mapping.sourceSystem })).run(runner);