CoachClientInvoices table
The CoachClientInvoices table in the FitStack - V2 schema has 17 columns, keyed by Id, with 3 foreign keys to CoachClientSubscriptions, CoachClients and Media.
Payouts ride on the Stripe Connect account recorded in Users.StripeConnectedAccountId.
Columns (17)
| Column | Type | Constraints | Description |
|---|---|---|---|
| Id | uuid | primary key, not null | |
| SubscriptionId | uuid | not null, references CoachClientSubscriptions.Id | v2 FIX: points at the COACH subscription. The Gym draft pointed this at GymClientSubscriptions. |
| CoachClientId | uuid | not null, references CoachClients.Id | v2 FIX: was GymClientId in the draft. |
| InvoiceNumber | text | not null | Stripe invoice number. |
| Status | text | not null | `CoachInvoiceStatus`. |
| IssuedOn | date | not null | |
| DueOn | date | ||
| PaidAt | timestamp with time zone | ||
| AmountCents | integer | not null | |
| PlatformFeeCents | integer | not null | FitStack take, mirroring PlanPurchases (52). |
| Currency | character varying(3) | not null | |
| MediaId | uuid | references Media.Id | Rendered PDF. Nullable — the invoice exists before the document does. |
| StripeInvoiceId | text | ||
| CreatedAt | timestamp with time zone | not null | |
| ModifiedAt | timestamp with time zone | ||
| IsDeleted | boolean | not null | |
| DeletedAt | timestamp with time zone |
Indexes (3)
(CoachClientId, IssuedOn)(IX_CoachClientInvoices_CoachClientId_IssuedOn)(InvoiceNumber)unique (IX_CoachClientInvoices_InvoiceNumber)(Status, DueOn)(IX_CoachClientInvoices_Status_DueOn)
Relationships
CoachClientInvoices.SubscriptionIdreferencesCoachClientSubscriptions.IdCoachClientInvoices.CoachClientIdreferencesCoachClients.IdCoachClientInvoices.MediaIdreferencesMedia.Id