IF Commons GitHub

contractField

concept

One field a data contract promises: its name, its datatype, whether it may be missing and how it is classified

Model contract. Written in commons/data/models/contract/mod.ts:73. Identified by contractFieldId.

Governance: attributes

classificationtextoptional

How sensitive it is: public, internal, confidential or restricted

Becomes the column classification of contract_field.

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

contractFieldIdidentifierrequired

What identifies the field: its contract and name

Becomes the column contract_field_id of contract_field.

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

datatypetextrequired

The datatype, as the contract names it

Becomes the column datatype of contract_field.

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

fieldNametextrequired

The name of the field

Becomes the column field_name of contract_field.

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

nullablebooleanrequired

Whether it may be missing

Becomes the column nullable of contract_field.

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

Governance: relationships

contractone

The contract it is a field of To dataContract. Written at commons/data/models/contract/mod.ts:73

Logical: the table

Projects to the table contract_field with the primary key contract_field_id.

ColumnTypeNullRoleFrom
classificationtexttrueattributecontractField.classification
contract_data_contract_idtextfalsereferencecontractField.contract
contract_field_idtextfalseattributecontractField.contractFieldId
datatypetextfalseattributecontractField.datatype
field_nametextfalseattributecontractField.fieldName
nullablebooleanfalseattributecontractField.nullable

Physical: SQL

CREATE TABLE IF NOT EXISTS "contract_field" (
    "contract_field_id" VARCHAR NOT NULL PRIMARY KEY,
    "field_name" VARCHAR NOT NULL,
    "datatype" VARCHAR NOT NULL,
    "nullable" BOOLEAN NOT NULL,
    "classification" VARCHAR,
    "contract_data_contract_id" VARCHAR NOT NULL,
    CONSTRAINT "contract_field_contract_data_contract_id_fk" FOREIGN KEY ("contract_data_contract_id") REFERENCES "data_contract" ("data_contract_id"),
    CONSTRAINT "contract_field_contract_data_contract_id_field_name_uq" UNIQUE ("contract_data_contract_id", "field_name")
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { contractField } 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 { contractField } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(contractField).select((s) => ({ contractFieldId: s.contractField.contractFieldId, fieldName: s.contractField.fieldName })).run(runner);

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