organization_role
Column |
Type |
PK |
Required |
Default |
organization_role_id |
VARCHAR |
Yes |
Yes |
|
person_id |
VARCHAR |
No |
Yes |
|
organization_id |
VARCHAR |
No |
Yes |
|
organization_role_type_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 |
organization_role_type_id |
organization_role_type_id references organization_role_type.organization_role_type_id |
organization_id |
organization_id references party.party_id |
person_id |
person_id references party.party_id |
Indexes
Column Name |
Index Name |
person_id |
idx_organization_role__person_id__organization_id__organization_role_type_id |
organization_id |
idx_organization_role__person_id__organization_id__organization_role_type_id |
organization_role_type_id |
idx_organization_role__person_id__organization_id__organization_role_type_id |
person_id |
sqlite_autoindex_organization_role_2 |
organization_id |
sqlite_autoindex_organization_role_2 |
organization_role_type_id |
sqlite_autoindex_organization_role_2 |
organization_role_id |
sqlite_autoindex_organization_role_1 |
SQL DDL
CREATE TABLE "organization_role" (
"organization_role_id" VARCHAR PRIMARY KEY NOT NULL,
"person_id" VARCHAR NOT NULL,
"organization_id" VARCHAR NOT NULL,
"organization_role_type_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("person_id") REFERENCES "party"("party_id"),
FOREIGN KEY("organization_id") REFERENCES "party"("party_id"),
FOREIGN KEY("organization_role_type_id") REFERENCES "organization_role_type"("organization_role_type_id"),
UNIQUE("person_id", "organization_id", "organization_role_type_id")
)