IF Commons GitHub

postalAddress

conceptpersonal data

A place a party receives post or may be visited

Model arcaParty. Written in commons/data/models/arca/party.ts:237. Identified by postalAddressId.

Governance: attributes

countryCodetext(max 2)requiredpersonal data

The country, as its two-letter ISO 3166-1 code

Becomes the column country_code of postal_address.

Annotations: privacy.personal={"category":"Country","purposes":["address the party"]}

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

line1textrequiredpersonal data

The first line: usually the building and the street

Becomes the column line_1 of postal_address.

Annotations: privacy.personal={"category":"PhysicalAddress","purposes":["reach the party by post","find where the party is"]}

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

line2textoptionalpersonal data

The second line, where there is one

Becomes the column line_2 of postal_address.

Annotations: privacy.personal={"category":"PhysicalAddress","purposes":["reach the party by post","find where the party is"]}

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

localitytextrequiredpersonal data

The town or city

Becomes the column locality of postal_address.

Annotations: privacy.personal={"category":"PhysicalAddress","purposes":["reach the party by post","find where the party is"]}

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

postalAddressIdidentifierrequired

What identifies the address

Becomes the column postal_address_id of postal_address.

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

postalCodetextoptionalpersonal data

The postal code, where the country uses one

Becomes the column postal_code of postal_address.

Annotations: privacy.personal={"category":"PhysicalAddress","purposes":["reach the party by post","find where the party is"]}

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

purposecode of addressPurposerequired

What the address is used for: where the party lives, is billed or receives deliveries

Becomes the column purpose of postal_address.

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

regiontextoptionalpersonal data

The state, province or county, where the country uses one

Becomes the column region of postal_address.

Annotations: privacy.personal={"category":"PhysicalAddress","purposes":["reach the party by post","find where the party is"]}

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

Governance: relationships

partyone

The party found at the address To party. Written at commons/data/models/arca/party.ts:237

Logical: the table

Projects to the table postal_address with the primary key postal_address_id.

ColumnTypeNullRoleFrom
country_codetextfalseattributepostalAddress.countryCode
line_1textfalseattributepostalAddress.line1
line_2texttrueattributepostalAddress.line2
localitytextfalseattributepostalAddress.locality
party_idtextfalsereferencepostalAddress.party
postal_address_idtextfalseattributepostalAddress.postalAddressId
postal_codetexttrueattributepostalAddress.postalCode
purposetextfalseattributepostalAddress.purpose
regiontexttrueattributepostalAddress.region

Physical: SQL

CREATE TABLE IF NOT EXISTS "postal_address" (
    "postal_address_id" VARCHAR NOT NULL PRIMARY KEY,
    "purpose" VARCHAR NOT NULL,
    "line_1" VARCHAR NOT NULL,
    "line_2" VARCHAR,
    "locality" VARCHAR NOT NULL,
    "region" VARCHAR,
    "postal_code" VARCHAR,
    "country_code" VARCHAR NOT NULL,
    "party_id" VARCHAR NOT NULL,
    CONSTRAINT "postal_address_party_id_fk" FOREIGN KEY ("party_id") REFERENCES "party" ("party_id"),
    CONSTRAINT "postal_address_purpose_ck" CHECK ("purpose" IN ('home', 'work', 'billing', 'delivery'))
);

Physical: the typed table

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

const rows = await from(postalAddress).select((s) => ({ postalAddressId: s.postalAddress.postalAddressId, purpose: s.postalAddress.purpose })).run(runner);

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