IF Commons GitHub

nullRule

concept

What a missing value is allowed to be for one field, the kind of absence it stands for and the default where it is replaced: the null policy of a field

Model meaning. Written in commons/data/models/meaning/mod.ts:110. Identified by nullRuleId.

Governance: attributes

absencecode of absenceoptional

The kind of absence a missing value is taken to be

Becomes the column absence of null_rule.

Written at commons/data/models/meaning/mod.ts:116

defaultValuetextoptional

The default, where the policy is to replace

Becomes the column default_value of null_rule.

Written at commons/data/models/meaning/mod.ts:117

nullRuleIdidentifierrequired

What identifies the rule: its table and column

Becomes the column null_rule_id of null_rule.

Written at commons/data/models/meaning/mod.ts:113

policycode of nullPolicyrequired

What is done with a missing value

Becomes the column policy of null_rule.

Written at commons/data/models/meaning/mod.ts:115

rationaletextrequired

Why

Becomes the column rationale of null_rule.

Written at commons/data/models/meaning/mod.ts:118

subjecttextrequired

The table and column it is about

Becomes the column subject of null_rule.

Written at commons/data/models/meaning/mod.ts:114

Logical: the table

Projects to the table null_rule with the primary key null_rule_id.

ColumnTypeNullRoleFrom
absencetexttrueattributenullRule.absence
default_valuetexttrueattributenullRule.defaultValue
null_rule_idtextfalseattributenullRule.nullRuleId
policytextfalseattributenullRule.policy
rationaletextfalseattributenullRule.rationale
subjecttextfalseattributenullRule.subject

Physical: SQL

CREATE TABLE IF NOT EXISTS "null_rule" (
    "null_rule_id" VARCHAR NOT NULL PRIMARY KEY,
    "subject" VARCHAR NOT NULL,
    "policy" VARCHAR NOT NULL,
    "absence" VARCHAR,
    "default_value" VARCHAR,
    "rationale" VARCHAR NOT NULL,
    CONSTRAINT "null_rule_subject_uq" UNIQUE ("subject"),
    CONSTRAINT "null_rule_policy_ck" CHECK ("policy" IN ('reject', 'allow_absent', 'default_to')),
    CONSTRAINT "null_rule_absence_ck" CHECK ("absence" IN ('not_collected', 'not_applicable', 'unknown', 'not_yet_known', 'refused', 'suppressed', 'invalid'))
);

Physical: the typed table

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

const rows = await from(nullRule).select((s) => ({ nullRuleId: s.nullRule.nullRuleId, subject: s.nullRule.subject })).run(runner);

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