GymEquipmentUnits table

The GymEquipmentUnits table in the FitStack - V2 schema has 17 columns, keyed by Id, with 3 foreign keys to Gyms, Equipment and GymZones. 3 columns in GymEquipmentUnitPhotos, GymEquipmentMaintenance and GymEquipmentReports reference it.

ONE ROW PER PHYSICAL UNIT. Replaces GymEquipment (80), which was one row per Entry per Gym with no way to say "the third one is out of order". The UI groups Units under their Entry ("Iso-Lateral Row × 3").

Columns (17)

Columns of the GymEquipmentUnits table
ColumnTypeConstraintsDescription
Iduuidprimary key, not null
GymIduuidnot null, references Gyms.Id
EquipmentIduuidnot null, references Equipment.IdThe catalogue Entry this Unit is an instance of. May be an unverified Entry the Gym proposed.
ZoneIduuidreferences GymZones.IdSET NULL.
AssetTagcharacter varying(100)The Gym's own label.
SerialNumbercharacter varying(200)
Statustextnot null`UnitStatus`.
PurchasedOndate
Notescharacter varying(2000)
MaintenanceFrequencytext`UnitMaintenanceFrequency`.
CustomFrequencyDaysintegerWhen Frequency = Custom. UI offers days/weeks/months and converts.
LastMaintenanceDatedate
NextMaintenanceDatedate
CreatedAttimestamp with time zonenot null
ModifiedAttimestamp with time zone
IsDeletedbooleannot null
DeletedAttimestamp with time zone

Indexes (4)

  • (GymId, EquipmentId) (IX_GymEquipmentUnits_GymId_EquipmentId)
  • (GymId, ZoneId) (IX_GymEquipmentUnits_GymId_ZoneId)
  • (GymId, NextMaintenanceDate) (IX_GymEquipmentUnits_GymId_NextMaintenanceDate)
  • (GymId, AssetTag) unique (IX_GymEquipmentUnits_GymId_AssetTag)

Relationships