IF Commons GitHub

partyRelation

concept

A relation between two parties for a time, read from the first to the second: Ada is employed by Analytical Engines

Model arcaParty. Written in commons/data/models/arca/party.ts:174. Identified by partyRelationId.

Governance: attributes

kindcode of partyRelationKindrequired

The way the first party is related to the second

Becomes the column party_relation_kind_code of party_relation.

Written at commons/data/models/arca/party.ts:178

partyRelationIdidentifierrequired

What identifies the relation

Becomes the column party_relation_id of party_relation.

Written at commons/data/models/arca/party.ts:177

validFromdaterequired

The first day the relation held

Becomes the column valid_from of party_relation.

Written at commons/data/models/arca/party.ts:179

validTodateoptional

The last day the relation held; empty while it still does

Becomes the column valid_to of party_relation.

Written at commons/data/models/arca/party.ts:180

Governance: relationships

fromone

The party the relation is read from To party. Written at commons/data/models/arca/party.ts:184

toone

The party the relation is read to To party. Written at commons/data/models/arca/party.ts:185

Logical: the table

Projects to the table party_relation with the primary key party_relation_id.

ColumnTypeNullRoleFrom
from_party_idtextfalsereferencepartyRelation.from
party_relation_idtextfalseattributepartyRelation.partyRelationId
party_relation_kind_codetextfalsereferencepartyRelation.kind
to_party_idtextfalsereferencepartyRelation.to
valid_fromdatefalseattributepartyRelation.validFrom
valid_todatetrueattributepartyRelation.validTo

Physical: SQL

CREATE TABLE IF NOT EXISTS "party_relation" (
    "party_relation_id" VARCHAR NOT NULL PRIMARY KEY,
    "party_relation_kind_code" VARCHAR NOT NULL,
    "valid_from" DATE NOT NULL,
    "valid_to" DATE,
    "from_party_id" VARCHAR NOT NULL,
    "to_party_id" VARCHAR NOT NULL,
    CONSTRAINT "party_relation_party_relation_kind_code_fk" FOREIGN KEY ("party_relation_kind_code") REFERENCES "party_relation_kind" ("code"),
    CONSTRAINT "party_relation_from_party_id_fk" FOREIGN KEY ("from_party_id") REFERENCES "party" ("party_id"),
    CONSTRAINT "party_relation_to_party_id_fk" FOREIGN KEY ("to_party_id") REFERENCES "party" ("party_id"),
    CONSTRAINT "party_relation_parties_differ_ck" CHECK ("from_party_id" <> "to_party_id")
);

Physical: the typed table

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

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

const rows = await from(partyRelation).select((s) => ({ partyRelationId: s.partyRelation.partyRelationId, partyRelationKindCode: s.partyRelation.partyRelationKindCode })).run(runner);

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