hr.person_wallet_ledger
Schema: hr
English table: hr.person_wallet_ledger
Italian original table: hr.ana_borsellino
Description: Person wallet ledger entries (multi-tenant). Stores amounts by date and type, linked to expense notes and source records.
Overview
- Columns: 16
- Primary key: id
- Outgoing foreign keys: 4
- Incoming foreign keys: 0
- Indexes: 11
Columns
| English column | Italian original column | Type | Null | Default / Generated | Description |
|---|---|---|---|---|---|
id | id | integer | NO | Surrogate primary key. | |
pwl_id | anab_id | integer | NO | Logical ledger entry identifier (unique per tenant). | |
pwl_person_id | anab_ana_id | integer | NO | Person identifier. FK to hr.person_registry(pr_id, tenant_id). | |
pwl_currency_id | anab_nsv_id | integer | NO | Currency identifier. FK to hr.in_notaspese_valute (to be translated). | |
pwl_date | anab_date | date | NO | Ledger entry date. | |
pwl_entry_type | anab_type | character varying(1) | NO | Entry type code (1 char). Semantics depend on business rules (e.g., credit/debit). | |
pwl_amount | anab_value | numeric(11,2) | NO | Entry amount (in ledger currency). | |
pwl_is_closed | anab_close | boolean | NO | Whether the ledger entry is closed/finalized. | |
pwl_expense_note_id | anab_ns_id | integer | NO | Expense note identifier (ns_* domain). | |
pwl_source_table | anab_table | character varying(20) | NO | Source table name for this entry (polymorphic link). | |
pwl_source_table_id | anab_table_id | integer | NO | Source record identifier for pwl_source_table. | |
pwl_amount_change | anab_value_change | numeric(12,5) | NO | Amount change component (delta), if applicable. | |
pwl_exchange_rate | anab_exchange_rates | numeric(10,2) | NO | Exchange rate applied for conversion, if applicable. | |
tenant_id | tenant_id | integer | YES | Tenant identifier for data isolation. | |
colcustom | colcustom | jsonb | YES | '{}'::jsonb | Custom fields (JSON). |
_deleted | _deleted | boolean | YES | false | Technical soft-delete flag. |
Relationships
Outgoing foreign keys
| Constraint | Local columns | References | Referenced columns | On update | On delete |
|---|---|---|---|---|---|
fk_pwl_currency_id | pwl_currency_id, tenant_id | hr.expense_note_currencies | enc_id, tenant_id | RESTRICT | RESTRICT |
fk_pwl_expense_note_id | pwl_expense_note_id, tenant_id | hr.expense_notes | en_id, tenant_id | RESTRICT | RESTRICT |
fk_pwl_person_id | pwl_person_id, tenant_id | hr.person_registry | pr_id, tenant_id | RESTRICT | CASCADE |
fk_pwl_tenant | tenant_id | cloud.tenants | ten_internal_id | RESTRICT | CASCADE |
Referenced by
No incoming foreign keys found.
Constraints
- Primary key:
pk_person_wallet_ledger→id - Unique:
uk_pwl_id_tenant→pwl_id, tenant_id
Indexes
| Name | Unique | Method | Columns / expression |
|---|---|---|---|
idx_person_wallet_ledger_tenant | NO | btree | tenant_id |
idx_pwl_currency_id_tenant | NO | btree | tenant_id, pwl_currency_id) WHERE (_deleted = false |
idx_pwl_date_tenant | NO | btree | tenant_id, pwl_date) WHERE (_deleted = false |
idx_pwl_entry_type_tenant | NO | btree | tenant_id, pwl_entry_type) WHERE (_deleted = false |
idx_pwl_expense_note_id_tenant | NO | btree | tenant_id, pwl_expense_note_id) WHERE (_deleted = false |
idx_pwl_id_tenant | NO | btree | tenant_id, pwl_id) WHERE (_deleted = false |
idx_pwl_person_currency_date_entry_type_tenant | NO | btree | tenant_id, pwl_person_id, pwl_currency_id, pwl_date, pwl_entry_type) WHERE (_deleted = false |
idx_pwl_person_entry_type_is_closed_tenant | NO | btree | tenant_id, pwl_person_id, pwl_entry_type, pwl_is_closed) WHERE (_deleted = false |
idx_pwl_person_id_tenant | NO | btree | tenant_id, pwl_person_id) WHERE (_deleted = false |
idx_pwl_source_table_id_tenant | NO | btree | tenant_id, pwl_source_table_id) WHERE (_deleted = false |
idx_pwl_source_table_source_id_tenant | NO | btree | tenant_id, pwl_source_table, pwl_source_table_id) WHERE (_deleted = false |
Navigation
- Back to main index
- [Back to
hrindex]../)