hr.customer_shift_schema_assignments
Schema: hr
English table: hr.customer_shift_schema_assignments
Italian original table: hr.in_clienti_profora
Description: Assigns weekly shift schemas to customers for specific validity periods.
Overview
- Columns: 10
- Primary key: id
- Outgoing foreign keys: 2
- Incoming foreign keys: 0
- Indexes: 6
Columns
| English column | Italian original column | Type | Null | Default / Generated | Description |
|---|---|---|---|---|---|
id | id | integer | NO | Internal surrogate primary key. | |
ssa_id | inclipo_id | integer | NO | Unique identifier for the assignment within a tenant. | |
ssa_customer_id | inclipo_incli_id | integer | NO | Reference to the customer. | |
ssa_shift_schema_id | inclipo_por_id | integer | NO | Reference to the weekly shift schema (profora). | |
ssa_valid_from | inclipo_dal | date | NO | Start date of the assignment. | |
ssa_valid_to | inclipo_al | date | NO | End date of the assignment. | |
tenant_id | tenant_id | integer | YES | Tenant identifier for data isolation. | |
colcustom | colcustom | jsonb | YES | '{}'::jsonb | JSON field for custom data. |
_deleted | _deleted | boolean | YES | false | Technical soft delete flag. |
ssa_validity_period | inclipo_periodo | daterange | YES | GENERATED: daterange(ssa_valid_from, ssa_valid_to, '[]'::text) | Generated daterange for the shift schema validity. |
Relationships
Outgoing foreign keys
| Constraint | Local columns | References | Referenced columns | On update | On delete |
|---|---|---|---|---|---|
fk_ssa_customer | ssa_customer_id, tenant_id | hr.customers | cust_id, tenant_id | RESTRICT | RESTRICT |
fk_ssa_tenant | tenant_id | cloud.tenants | ten_internal_id | RESTRICT | CASCADE |
Referenced by
No incoming foreign keys found.
Constraints
- Primary key:
pk_customer_shift_schema_assignments→id - Unique:
uk_ssa_id_tenant→ssa_id, tenant_id
Indexes
| Name | Unique | Method | Columns / expression |
|---|---|---|---|
idx_ssa_tenant | NO | btree | tenant_id |
idx_ssa_id | NO | btree | tenant_id, ssa_id) WHERE (_deleted = false |
idx_ssa_customer | NO | btree | tenant_id, ssa_customer_id) WHERE (_deleted = false |
idx_ssa_schema | NO | btree | tenant_id, ssa_shift_schema_id) WHERE (_deleted = false |
idx_ssa_customer_period | NO | gist | tenant_id, ssa_customer_id, ssa_validity_period) WHERE (_deleted = false |
idx_ssa_period | NO | gist | tenant_id, ssa_validity_period) WHERE (_deleted = false |