Skip to main content

hr.documents

Schema: hr
English table: hr.documents
Italian original table: hr.in_documents
Description: Core table for all document instances (requests, justifications, etc.) and their workflow state.

Overview

  • Columns: 20
  • Primary key: id
  • Outgoing foreign keys: 3
  • Incoming foreign keys: 3
  • Indexes: 11

Columns

English columnItalian original columnTypeNullDefault / GeneratedDescription
ididintegerNOInternal surrogate primary key.
doc_iddoc_idintegerNOUnique document identifier within a tenant.
doc_created_datedoc_cr_datedateNODate when the document was created.
doc_created_timedoc_cr_timeintegerNOTime of creation (integer format).
doc_document_model_iddoc_dm_idintegerNOReference to the document model/type.
doc_status_codedoc_statusnumeric(1,0)NOCurrent status code of the document.
doc_workflow_stepdoc_stepnumeric(1,0)NOCurrent step in the workflow sequence.
doc_creator_employment_iddoc_cr_rap_idintegerNOReference to the employment that created the document.
doc_subject_employment_iddoc_rif_rap_idintegerNOReference to the employment the document refers to.
doc_current_holder_iddoc_det_idintegerNOReference to the current owner/holder in the workflow.
doc_payload_datadoc_datatextNOContent or serialized data of the document.
doc_valid_fromdoc_daldateNOStart date of the document validity period.
doc_valid_todoc_aldateNOEnd date of the document validity period.
doc_is_readdoc_lettobooleanNOFlag indicating if the document has been read by the current holder.
doc_descriptiondoc_descriptioncharacter varying(250)NODescriptive text for the document.
doc_required_datedoc_date_requireddateNOThe date by which the document or action is required.
tenant_idtenant_idintegerYESTenant identifier for data isolation.
colcustomcolcustomjsonbYES'{}'::jsonbJSON field for custom data.
_deleted_deletedbooleanYESfalseTechnical soft delete flag.
doc_validity_perioddoc_periododaterangeYESGENERATED: daterange(doc_valid_from, doc_valid_to, '[]'::text)Generated daterange for the document validity period.

Relationships

Outgoing foreign keys

ConstraintLocal columnsReferencesReferenced columnsOn updateOn delete
fk_documents_modeldoc_document_model_id, tenant_idhr.document_modelsdmdl_id, tenant_idRESTRICTRESTRICT
fk_documents_subject_employmentdoc_subject_employment_id, tenant_idhr.employment_relationshipser_id, tenant_idRESTRICTCASCADE
fk_documents_tenanttenant_idcloud.tenantsten_internal_idRESTRICTCASCADE

Referenced by

From tableForeign keySource columnsTarget columns
hr.in_documents_logfk_doc_iddocl_doc_id, tenant_iddoc_id, tenant_id
pres.employee_clockingsfk_timbra_tim_doc_id_to_documentstenant_id, ec_document_idtenant_id, doc_id
pres.long_term_absencesfk_giustif_arg_doc_id_to_documentitenant_id, lta_document_idtenant_id, doc_id

Constraints

  • Primary key: pk_documentsid
  • Unique: in_documents_tenant_id_keytenant_id, doc_id
  • Unique: uk_documents_iddoc_id, tenant_id

Indexes

NameUniqueMethodColumns / expression
idx_doc_creator_employment_tenantNObtreetenant_id, doc_creator_employment_id) WHERE (_deleted = false
idx_doc_current_holder_tenantNObtreetenant_id, doc_current_holder_id) WHERE (_deleted = false
idx_doc_id_tenantNObtreetenant_id, doc_id) WHERE (_deleted = false
idx_doc_model_tenantNObtreetenant_id, doc_document_model_id) WHERE (_deleted = false
idx_doc_status_tenantNObtreetenant_id, doc_status_code) WHERE (_deleted = false
idx_doc_subject_employment_start_tenantNObtreetenant_id, doc_subject_employment_id, doc_valid_from, doc_status_code) WHERE (_deleted = false
idx_doc_subject_employment_tenantNObtreetenant_id, doc_subject_employment_id) WHERE (_deleted = false
idx_doc_tenantNObtreetenant_id
idx_doc_tenant_employment_period_status_gistNOgisttenant_id, doc_subject_employment_id, doc_validity_period, doc_status_code) WHERE (_deleted = false
idx_doc_tenant_employment_period_status_pending_gistNOgisttenant_id, doc_subject_employment_id, doc_validity_period, doc_status_code) WHERE ((_deleted = false) AND (doc_status_code < (3)::numeric)
idx_doc_tenant_period_gistNOgisttenant_id, doc_validity_period) WHERE (_deleted = false