SiteVersions table
The SiteVersions table in the FitStack - V2 schema has 9 columns, keyed by Id, with 3 foreign keys to Sites and Employees.
Version history for rollback. No soft delete: versions are kept.
Columns (9)
| Column | Type | Constraints | Description |
|---|---|---|---|
| Id | uuid | primary key, not null, references Sites.DraftVersionId | |
| SiteId | uuid | not null, references Sites.Id | CASCADE. |
| Number | integer | not null | Monotonic per Site. |
| PagesJson | jsonb | not null | The block tree: { pages: [ { key, path, title, blocks: [ { id, type, props, children? } ] } ] } Location pages for each Gym are generated into this tree at save time so the renderer never needs the Gym tables; dynamic data (timetable, offers, products, trainers) is referenced by id in block props and resolved by the public read endpoint. |
| IsImmutable | boolean | not null | True once published or superseded; only the current draft version is mutable. |
| CreatedByEmployeeId | uuid | references Employees.Id | |
| PublishedAt | timestamp with time zone | Set when this version became the published one. | |
| CreatedAt | timestamp with time zone | not null | |
| ModifiedAt | timestamp with time zone |
Indexes (1)
(SiteId, Number)unique (IX_SiteVersions_SiteId_Number)
Relationships
SiteVersions.IdreferencesSites.DraftVersionIdSiteVersions.SiteIdreferencesSites.IdSiteVersions.CreatedByEmployeeIdreferencesEmployees.Id