worker_link

-1 rows


Columns

Column Type Size Nulls Auto Default Children Parents Comments
worker_link_id uuid 2147483647 null
worker_document_upload_idempotency.worker_link_id fk_worker_document_upload_idempotency_link_company R
worker_link.replaces_link_id fk_worker_link_replaces_company R
worker_response.worker_link_id fk_worker_response_link_company R
task_id uuid 2147483647 null
task.task_id fk_worker_link_task_company R
company_id uuid 2147483647 null
worker_document_upload_idempotency.company_id fk_worker_document_upload_idempotency_link_company R
worker_link.company_id fk_worker_link_replaces_company R
worker_response.company_id fk_worker_response_link_company R
company.company_id fk_worker_link_company R
worker_link.company_id fk_worker_link_replaces_company R
user_account.company_id fk_worker_link_sent_by_company R
task.company_id fk_worker_link_task_company R
token_hash varchar 64 null
expires_at timestamptz 35,6 null
status varchar 20 null
conversation_status varchar 20 null
assignee_id uuid 2147483647 null
user_account.user_id fk_worker_link_assignee_company R
issued_by uuid 2147483647 null
user_account.user_id fk_worker_link_issued_by_company R
replaces_link_id uuid 2147483647 null
worker_link.worker_link_id fk_worker_link_replaces_company R
idempotency_key varchar 100 null
created_at timestamptz 35,6 CURRENT_TIMESTAMP
updated_at timestamptz 35,6 CURRENT_TIMESTAMP
version int8 19 0
delivery_status varchar 20 'NOT_SENT'::character varying
sent_at timestamptz 35,6 null
sent_by uuid 2147483647 null
user_account.user_id fk_worker_link_sent_by_company R

Indexes

Constraint Name Type Sort Column(s)
pk_worker_link Primary key Asc worker_link_id
idx_worker_link_company Performance Asc company_id
idx_worker_link_task Performance Asc/Asc task_id + company_id
uq_worker_link_id_company Must be unique Asc/Asc worker_link_id + company_id
uq_worker_link_task_idempotency Must be unique Asc/Asc task_id + idempotency_key
uq_worker_link_token_hash Must be unique Asc token_hash

Check Constraints

Constraint Name Constraint
ck_worker_link_hash_lowercase (((token_hash)::text = lower((token_hash)::text)))
ck_worker_link_version ((version >= 0))
ck_worker_link_status (((status)::text = ANY ((ARRAY['ACTIVE'::character varying, 'EXPIRED'::character varying, 'REVOKED'::character varying])::text[])))
ck_worker_link_expiry ((expires_at > created_at))
ck_worker_link_conversation_status (((conversation_status)::text = ANY ((ARRAY['WAITING_WORKER'::character varying, 'NEEDS_FOLLOWUP'::character varying, 'REOPENED'::character varying])::text[])))
ck_worker_link_delivery_status (((delivery_status)::text = ANY ((ARRAY['NOT_SENT'::character varying, 'SENDING'::character varying, 'REVIEW_REQUIRED'::character varying, 'SENT'::character varying])::text[])))
ck_worker_link_hash_length ((char_length((token_hash)::text) = 64))
ck_worker_link_delivery_state (((((delivery_status)::text = ANY ((ARRAY['NOT_SENT'::character varying, 'SENDING'::character varying, 'REVIEW_REQUIRED'::character varying])::text[])) AND (sent_at IS NULL) AND (sent_by IS NULL)) OR (((delivery_status)::text = 'SENT'::text) AND (sent_at IS NOT NULL) AND (sent_by IS NOT NULL))))
ck_worker_link_updated_at ((updated_at >= created_at))

Relationships