app.payment_applications
TableRow level security on
How much of a payment settles which invoice. A payment applies to an invoice once and never beyond its amount, and an invoice is never paid beyond its total, so billed-to-date and paid-to-date count each payment once (invariant 16).
Primary key: id
| Column | Type | Nullable | Description |
|---|---|---|---|
| id | uuid | No | Primary key, UUID v7. |
| org_id | uuid | No | Owning org, derived from app.payments on insert; never accepted from the caller and never changed.References app.organizations.id |
| payment_id | uuid | No | Payment applied.References app.payments.id |
| invoice_id | uuid | No | Invoice settled, with the same counterparty, direction and currency.References app.invoices.id |
| amount_minor | bigint | No | Amount applied in minor units. |
| deleted_at | timestamp with time zone | Yes | 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 | Yes | Person who inserted the row, or null for a platform process. Set by the database.References app.people.id |
| updated_at | timestamp with time zone | No | When the row last changed. Set by the database. |
| updated_by | uuid | Yes | Person who last changed the row, or null for a platform process. Set by the database.References app.people.id |