CREATE TABLE `organization_role` (
`organization_role_id` text PRIMARY KEY NOT NULL,
`person_id` text NOT NULL,
`organization_id` text NOT NULL,
`organization_role_type_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 (`person_id`) REFERENCES `party`(`party_id`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`organization_id`) REFERENCES `party`(`party_id`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`organization_role_type_id`) REFERENCES `organization_role_type`(`organization_role_type_id`) ON UPDATE no action ON DELETE no action,
CONSTRAINT "elaboration_check_valid_json" CHECK(json_valid("organization_role"."elaboration") OR "organization_role"."elaboration" IS NULL)
)