hr.equipment_assignments
Schema: hr
English table: hr.equipment_assignments
Italian original table: hr.dotazioni_link
Description: Equipment assignments to employees. Tracks which equipment is assigned to which employee, the assignment period, expiration date, and notes. Examples: laptop assigned to developer, safety helmet to construction worker, company car to sales manager.
Overview
- Columns: 12
- Primary key: id
- Outgoing foreign keys: 3
- Incoming foreign keys: 0
- Indexes: 7
Columns
| English column | Italian original column | Type | Null | Default / Generated | Description |
|---|---|---|---|---|---|
id | id | integer | NO | Primary key (internal surrogate ID). | |
eqa_id | dotli_id | integer | NO | Business identifier for the equipment assignment (unique within tenant). | |
eqa_employment_id | dotli_rap_id | integer | NO | Employment relationship identifier (references hr.employment_relationships.rap_id). | |
eqa_equipment_id | dotli_dot_id | integer | NO | Equipment item identifier (references hr.equipment.eq_id). | |
eqa_assigned_from | dotli_dal | date | NO | Assignment start date (when the equipment was given to the employee). | |
eqa_expires_on | dotli_data_scadenza | date | NO | Expiration date for equipment requiring periodic renewal (e.g., certification expiry, license renewal, lease end). May differ from assignment end date. | |
eqa_notes | dotli_note | text | NO | Additional notes about the assignment (e.g., condition at delivery, serial number, special terms). | |
tenant_id | tenant_id | integer | YES | Tenant identifier for multi-tenancy (references cloud._tenant). | |
colcustom | colcustom | jsonb | YES | '{}'::jsonb | JSON object for custom fields and tenant-specific extensions. |
_deleted | _deleted | boolean | YES | false | Soft delete flag for technical deletion (not functional cancellation). |
eqa_assigned_to | dotli_al | date | YES | Assignment end date (when the equipment was returned or assignment ended). NULL means currently assigned. | |
eqa_assignment_period | dotli_periodo | daterange | YES | GENERATED: daterange(eqa_assigned_from, eqa_assigned_to, '[]'::text) | Assignment period as daterange (auto-generated from eqa_assigned_from and eqa_assigned_to). Used for temporal queries and overlap detection. |
Relationships
Outgoing foreign keys
| Constraint | Local columns | References | Referenced columns | On update | On delete |
|---|---|---|---|---|---|
fk_eqa_employment | eqa_employment_id, tenant_id | hr.employment_relationships | er_id, tenant_id | RESTRICT | CASCADE |
fk_eqa_equipment | eqa_equipment_id, tenant_id | hr.equipment | eq_id, tenant_id | RESTRICT | RESTRICT |
fk_eqa_tenant | tenant_id | cloud.tenants | ten_internal_id | RESTRICT | CASCADE |
Referenced by
No incoming foreign keys found.
Constraints
- Primary key:
pk_equipment_assignments→id - Unique:
uk_equipment_assignments_eqa_id_tenant→eqa_id, tenant_id
Indexes
| Name | Unique | Method | Columns / expression |
|---|---|---|---|
idx_eqa_tenant | NO | btree | tenant_id |
idx_eqa_tenant_empl | NO | btree | tenant_id, eqa_employment_id) WHERE (_deleted = false |
idx_eqa_tenant_empl_period_gist | NO | gist | tenant_id, eqa_employment_id, eqa_assignment_period) WHERE (_deleted = false |
idx_eqa_tenant_eqa_id | NO | btree | tenant_id, eqa_id) WHERE (_deleted = false |
idx_eqa_tenant_equip | NO | btree | tenant_id, eqa_equipment_id) WHERE (_deleted = false |
idx_eqa_tenant_expires | NO | btree | tenant_id, eqa_expires_on) WHERE (_deleted = false |
idx_eqa_tenant_period_gist | NO | gist | tenant_id, eqa_assignment_period) WHERE (_deleted = false |
Navigation
- Back to main index
- [Back to
hrindex]../)