app.approval_instances
TablaSeguridad a nivel de fila activa
A spend document going through its approval policy. Created only by app.request_approval, which reads the amount, currency and project from the document; decided step by step through app.decide_approval.
Clave primaria: id
| Columna | Tipo | Admite nulos | Descripción |
|---|---|---|---|
| id | uuid | No | Primary key, UUID v7. |
| org_id | uuid | No | Owning org, derived from app.approval_policies on insert; never accepted from the caller and never changed.Hace referencia a app.organizations.id |
| approval_policy_id | uuid | No | Policy the document goes through.Hace referencia a app.approval_policies.id |
| document_type | app.spend_document_type | No | Spend document type. |
| document_id | uuid | No | Id of the document in subject_table. |
| subject_table | text | No | Table of the document: purchase_orders, po_change_orders, change_orders, invoices, requisitions, expenses or payroll_runs. |
| subject_reference | text | Sí | The document's own number or name when requested, for display. |
| project_id | uuid | Sí | Project of the document; NULL for org-level documents such as payroll runs.Hace referencia a app.projects.id |
| amount_minor | bigint | No | Amount submitted for approval, in minor units; the approval covers the document only while its amount stays at or below it. |
| currency_code | character(3) | No | ISO 4217 currency of the amount.Hace referencia a private.currencies.currency_code |
| requested_by | uuid | No | Person who requested the approval; never an approver of it (sod_approval_requester).Hace referencia a app.people.id |
| approval_state | app.approval_state | No | In Review, Approved, Rejected or Canceled. Changes only through the approval RPCs. |
| current_step | smallint | No | Step order waiting for a decision while In Review; the last step decided afterwards. |
| decided_at | timestamp with time zone | Sí | When the approval was approved, rejected or canceled; NULL while In Review. |
| deleted_at | timestamp with time zone | Sí | Soft delete time. A row with deleted_at set is ignored by every access helper. |
| created_at | timestamp with time zone | No | When the row was inserted. Set by the database. |
| created_by | uuid | Sí | Person who inserted the row, or null for a platform process. Set by the database.Hace referencia a app.people.id |
| updated_at | timestamp with time zone | No | When the row last changed. Set by the database. |
| updated_by | uuid | Sí | Person who last changed the row, or null for a platform process. Set by the database.Hace referencia a app.people.id |