hr.expense_note_attachments
Schema: hr
English table: hr.expense_note_attachments
Italian original table: hr.in_notaspese_allegati
Description: Expense note attachments linked to expense note lines (binary payload stored in table). Soft-delete via _deleted.
Overview
- Columns: 9
- Primary key: id
- Outgoing foreign keys: 2
- Incoming foreign keys: 0
- Indexes: 3
Columns
| English column | Italian original column | Type | Null | Default / Generated | Description |
|---|
id | id | integer | NO | | Surrogate primary key. |
ena_id | nsa_id | integer | NO | | Logical attachment identifier (unique per tenant). |
ena_enl_id | nsa_nsd_id | integer | NO | | Reference to the expense note line this attachment belongs to (enl_id). |
ena_filename | nsa_nomefile | character varying(100) | NO | | Original file name as uploaded/stored. |
ena_file | nsa_file | bytea | NO | | Binary file content (bytea). |
ena_file_type | nsa_tipo | character varying(100) | NO | | File type information (e.g., MIME type or attachment classification, depending on application usage). |
tenant_id | tenant_id | integer | YES | | Tenant identifier for data isolation. |
colcustom | colcustom | jsonb | YES | '{}'::jsonb | Custom fields (JSONB). |
_deleted | _deleted | boolean | YES | false | Technical soft delete flag (not a functional deletion). |
Relationships
Outgoing foreign keys
| Constraint | Local columns | References | Referenced columns | On update | On delete |
|---|
fk_ena_enl_id_tenant | ena_enl_id, tenant_id | hr.expense_note_lines | enl_id, tenant_id | RESTRICT | RESTRICT |
fk_ena_tenant_id | tenant_id | cloud.tenants | ten_internal_id | RESTRICT | CASCADE |
Referenced by
No incoming foreign keys found.
Constraints
- Primary key:
pk_expense_note_attachments → id
- Unique:
uk_ena_id_tenant → ena_id, tenant_id
Indexes
| Name | Unique | Method | Columns / expression |
|---|
idx_expense_note_attachments_ena_enl_id_tenant | NO | btree | tenant_id, ena_enl_id) WHERE (_deleted = false |
idx_expense_note_attachments_ena_id_tenant | NO | btree | tenant_id, ena_id) WHERE (_deleted = false |
idx_expense_note_attachments_tenant | NO | btree | tenant_id |
Navigation