person

Column Type PK Required Default
person_id ULID Yes Yes
party_id VARCHAR No Yes
person_type_id ULID No Yes
person_first_name TEXT No Yes
person_middle_name TEXT No No
person_last_name TEXT No Yes
previous_name TEXT No No
honorific_prefix TEXT No No
honorific_suffix TEXT No No
gender_id ULID No Yes
sex_id ULID No Yes
elaboration TEXT No No
created_at TIMESTAMPTZ No No CURRENT_TIMESTAMP
created_by TEXT No No 'UNKNOWN'
updated_at TIMESTAMPTZ No No
updated_by TEXT No No
deleted_at TIMESTAMPTZ No No
deleted_by TEXT No No
activity_log TEXT No No

Foreign Keys

Column Name Foreign Key
sex_id sex_id references sex_type.sex_type_id
gender_id gender_id references gender_type.gender_type_id
person_type_id person_type_id references person_type.person_type_id
party_id party_id references party.party_id

Indexes

Column Name Index Name
person_id sqlite_autoindex_person_1

SQL DDL

CREATE TABLE "person" (
    "person_id" ULID PRIMARY KEY NOT NULL,
    "party_id" VARCHAR NOT NULL,
    "person_type_id" ULID NOT NULL,
    "person_first_name" TEXT NOT NULL,
    "person_middle_name" TEXT,
    "person_last_name" TEXT NOT NULL,
    "previous_name" TEXT,
    "honorific_prefix" TEXT,
    "honorific_suffix" TEXT,
    "gender_id" ULID NOT NULL,
    "sex_id" ULID NOT NULL,
    "elaboration" TEXT CHECK(json_valid(elaboration) OR elaboration IS NULL),
    "created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
    "created_by" TEXT DEFAULT 'UNKNOWN',
    "updated_at" TIMESTAMPTZ,
    "updated_by" TEXT,
    "deleted_at" TIMESTAMPTZ,
    "deleted_by" TEXT,
    "activity_log" TEXT,
    FOREIGN KEY("party_id") REFERENCES "party"("party_id"),
    FOREIGN KEY("person_type_id") REFERENCES "person_type"("person_type_id"),
    FOREIGN KEY("gender_id") REFERENCES "gender_type"("gender_type_id"),
    FOREIGN KEY("sex_id") REFERENCES "sex_type"("sex_type_id")
)