Schema: hr
English table: hr.company_work_sites
Italian original table: hr.sedi_link
Description: Many-to-many relationship mapping between legal companies and their operational work sites/branches.
Overview
- Columns: 7
- Primary key: id
- Outgoing foreign keys: 3
- Incoming foreign keys: 0
- Indexes: 4
Columns
| English column | Italian original column | Type | Null | Default / Generated | Description |
|---|
id | id | integer | NO | | Surrogate primary key. |
cws_id | sedel_id | integer | NO | | Identifier of the related cws record. |
cws_work_site_id | sedel_sede_id | integer | NO | | Reference to the operational work site. |
cws_company_id | sedel_az_id | integer | NO | | Reference to the legal company entity. |
tenant_id | tenant_id | integer | YES | | Tenant identifier for data isolation. |
colcustom | colcustom | jsonb | YES | '{}'::jsonb | JSON payload containing additional attributes. |
_deleted | _deleted | boolean | YES | false | Flag indicating whether the record is soft-deleted. |
Relationships
Outgoing foreign keys
| Constraint | Local columns | References | Referenced columns | On update | On delete |
|---|
fk_sedel_az_id | cws_company_id, tenant_id | hr.companies | cmp_id, tenant_id | RESTRICT | RESTRICT |
fk_sedel_sede_id | cws_work_site_id, tenant_id | hr.work_sites | sede_id, tenant_id | RESTRICT | RESTRICT |
fk_tenant_id | tenant_id | cloud.tenants | ten_internal_id | RESTRICT | CASCADE |
Referenced by
No incoming foreign keys found.
Constraints
- Primary key:
pk_company_work_sites → id
- Unique:
uk_cws_id_tenant → cws_id, tenant_id
Indexes
| Name | Unique | Method | Columns / expression |
|---|
idx_cws_company_tenant | NO | btree | tenant_id, cws_company_id) WHERE (_deleted = false |
idx_cws_id_tenant | NO | btree | tenant_id, cws_id) WHERE (_deleted = false |
idx_cws_tenant | NO | btree | tenant_id |
idx_cws_work_site_tenant | NO | btree | tenant_id, cws_work_site_id) WHERE (_deleted = false |
Navigation