Base de datos: libro de saldo por cliente

Base de datos: libro de saldo por cliente Un diagrama de entidad-relación generado por Archify. clients · Entidad clients PK id UUID tenant_id UUID company_name TEXT nit TEXT contact_name TEXT contact_email TEXT contact_phone TEXT address TEXT country_code TEXT currency TEXT notes TEXT is_active BOOLEAN total_deposited BIGINT total_dispersed BIGINT last_activity_at TIMESTAMPTZ created_at TIMESTAMPTZ updated_at TIMESTAMPTZ logo_base64 TEXT client_balances · Entidad client_balances tenant_id UUID PKFK client_id UUID PK funding_source TEXT available BIGINT pending_settlement BIGINT reserved BIGINT updated_at TIMESTAMPTZ client_ledger_entries · Entidad client_ledger_entries PK id UUID tenant_id UUID client_id UUID funding_source TEXT kind TEXT d_available BIGINT d_pending BIGINT d_reserved BIGINT available_after BIGINT pending_after BIGINT reserved_after BIGINT ref_type TEXT ref_id UUID detail JSONB idempotency_key TEXT created_by UUID created_at TIMESTAMPTZ ledger_settings · Entidad ledger_settings PK key TEXT value TEXT updated_at TIMESTAMPTZ updated_by UUID settlement_batches · Entidad settlement_batches PK id UUID tenant_id UUID funding_source TEXT status TEXT expected_amount BIGINT confirmed_amount BIGINT provider_reference TEXT notes TEXT requested_by UUID requested_at TIMESTAMPTZ confirmed_by UUID confirmed_at TIMESTAMPTZ settlement_batch_items · Entidad settlement_batch_items PKFK batch_id UUID PK deposit_id UUID client_id UUID amount BIGINT active BOOLEAN ledger_reconciliation_runs · Entidad ledger_reconciliation_runs PK id UUID tenant_id UUID run_date DATE trigger TEXT mode TEXT status TEXT alerts TEXT[] integrity JSONB created_by UUID created_at TIMESTAMPTZ ledger_reconciliation_lines · Entidad ledger_reconciliation_lines PK id BIGSERIAL FK run_id UUID tenant_id UUID funding_source TEXT real_balance BIGINT real_balance_at TIMESTAMPTZ clients_available BIGINT clients_pending BIGINT clients_reserved BIGINT clients_total_all_tenants BIGINT platform_remainder BIGINT status TEXT ledger_mode_history · Entidad ledger_mode_history PK id BIGSERIAL changed_at TIMESTAMPTZ changed_by UUID previous_mode TEXT new_mode TEXT client_id batch_id run_id Leyenda PK Clave primaria FK Clave foránea Uno Muchos