person

Column Type PK Required Default
person_id ULID Yes Yes
party_id TEXT 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` text 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,
	`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`) ON UPDATE no action ON DELETE no action,
	FOREIGN KEY (`person_type_id`) REFERENCES `person_type`(`person_type_id`) ON UPDATE no action ON DELETE no action,
	FOREIGN KEY (`gender_id`) REFERENCES `gender_type`(`gender_type_id`) ON UPDATE no action ON DELETE no action,
	FOREIGN KEY (`sex_id`) REFERENCES `sex_type`(`sex_type_id`) ON UPDATE no action ON DELETE no action,
	CONSTRAINT "elaboration_check_valid_json" CHECK(json_valid("person"."elaboration") OR "person"."elaboration" IS NULL)
)