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)
| Column | Type | Constraints | Description |
|---|---|---|---|
| Id | uuid | primary key, not null | |
| GymId | uuid | not null, references Gyms.Id | |
| EquipmentId | uuid | not null, references Equipment.Id | The catalogue Entry this Unit is an instance of. May be an unverified Entry the Gym proposed. |
| ZoneId | uuid | references GymZones.Id | SET NULL. |
| AssetTag | character varying(100) | The Gym's own label. | |
| SerialNumber | character varying(200) | ||
| Status | text | not null | `UnitStatus`. |
| PurchasedOn | date | ||
| Notes | character varying(2000) | ||
| MaintenanceFrequency | text | `UnitMaintenanceFrequency`. | |
| CustomFrequencyDays | integer | When Frequency = Custom. UI offers days/weeks/months and converts. | |
| LastMaintenanceDate | date | ||
| NextMaintenanceDate | date | ||
| CreatedAt | timestamp with time zone | not null | |
| ModifiedAt | timestamp with time zone | ||
| IsDeleted | boolean | not null | |
| DeletedAt | timestamp 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
GymEquipmentUnits.GymIdreferencesGyms.IdGymEquipmentUnits.EquipmentIdreferencesEquipment.IdGymEquipmentUnits.ZoneIdreferencesGymZones.IdGymEquipmentUnitPhotos.UnitIdreferencesGymEquipmentUnitsGymEquipmentMaintenance.UnitIdreferencesGymEquipmentUnitsGymEquipmentReports.UnitIdreferencesGymEquipmentUnits