Coaches table

The Coaches table in the FitStack - V2 schema has 18 columns, keyed by Id, with 3 foreign keys to Trainers, Media and Users. 14 columns in Users, CoachStatusEvents, CoachCertifications, CoachSpecialtyTags and 10 more reference it.

One row per user who coaches. `UserId` is unique, so coaching is a facet of an account, not a separate account. **Status is a gate, not a label.** Only `Approved` may hold active clients or hold data-access grants. Suspending a coach must cascade to `CoachAccessGrants` (62) — otherwise a suspended coach keeps reading client health data, which is exactly the failure the consent model exists to prevent. Reintroducing this domain also needs a `Coach` entry in the `UserType` enum; ordinal 7 was vacated by the removal migration. See 00-conventions.

Columns (18)

Columns of the Coaches table
ColumnTypeConstraintsDescription
Iduuidprimary key, not null, references Trainers.CoachId
UserIdtextnot nullv2 FIX: a real FK. In v1 this was a dangling `text` column with no constraint, so a coach could outlive its user.
Statustextnot null`CoachStatus`.
Headlinecharacter varying(140)
Biocharacter varying(4000)
HourlyRateUsdnumeric(10,2)
HeroMediaIduuidreferences Media.Idv2 FIX: real FK. Was a loose uuid.
TimeZonecharacter varying(64)not nullv2 ADD: IANA id. v1 stored a timezone per availability row, so a coach with no availability had no timezone at all.
AcceptingNewClientsbooleannot nullv2 ADD: BrowseCoaches filtered on a field that did not exist.
MaxActiveClientsintegerv2 ADD: null = unlimited. Enforced in the app; see CoachClients.
SubmittedForReviewAttimestamp with time zone
ApprovedByUserIdtextreferences Users.Idv2 FIX: real FK.
ApprovedAttimestamp with time zone
RejectionReasoncharacter varying(2000)
CreatedAttimestamp with time zonenot null
ModifiedAttimestamp with time zone
IsDeletedbooleannot null
DeletedAttimestamp with time zone

Indexes (3)

  • (UserId) unique (IX_Coaches_UserId)
  • (Status) (IX_Coaches_Status)
  • (Status, AcceptingNewClients) (IX_Coaches_Status_AcceptingNewClients)

Relationships