Sessions table

The Sessions table in the FitStack - V2 schema has 15 columns, keyed by Id, with 5 foreign keys to Courses, CourseSchedules, Gyms, Studios and 1 more. 2 columns in SessionCodes and Enrolments reference it.

One occurrence. Replaces Classes (81). Glossary: Session; avoid Class.

Columns (15)

Columns of the Sessions table
ColumnTypeConstraintsDescription
Iduuidprimary key, not null
CourseIduuidnot null, references Courses.Id
ScheduleIduuidreferences CourseSchedules.IdNull for a one-off Session. SET NULL.
GymIduuidnot null, references Gyms.IdDenormalised from the Course for timetable queries.
StudioIduuidnot null, references Studios.Id
TrainerIduuidreferences Trainers.IdNull = unstaffed; shown as needing a Trainer.
StartsAttimestamp with time zonenot null
EndsAttimestamp with time zonenot null
Capacityintegernot nullResolved at generation: Course, else Studio.
Statustextnot null`SessionStatus`.
CancelReasoncharacter varying(500)
CreatedAttimestamp with time zonenot null
ModifiedAttimestamp with time zone
IsDeletedbooleannot null
DeletedAttimestamp with time zone

Indexes (4)

  • (GymId, StartsAt) (IX_Sessions_GymId_StartsAt)
  • (CourseId, StartsAt) (IX_Sessions_CourseId_StartsAt)
  • (TrainerId, StartsAt) (IX_Sessions_TrainerId_StartsAt)
  • (StudioId, StartsAt) (IX_Sessions_StudioId_StartsAt)

Relationships