Sites table
The Sites table in the FitStack - V2 schema has 15 columns, keyed by Id. 5 columns in Companies, SiteVersions and SiteDomains reference it.
Columns (15)
| Column | Type | Constraints | Description |
|---|---|---|---|
| Id | uuid | primary key, not null | |
| CompanyId | uuid | not null | ONE Site per Company (ADR 0011). |
| Subdomain | character varying(63) | not null | DNS label under the FitStack Gym sites domain; defaults to the Company slug. |
| Status | text | not null | `SiteStatus`. |
| TemplateKey | character varying(50) | not null | Which starting layout the Site was generated from. |
| ThemeJson | jsonb | not null | {colors:{primary,…}, fonts:{heading,body}, logoMediaId, radius}. Validated against the renderer's theme schema. |
| PublishedVersionId | uuid | The version visitors see. Null while Draft/Unpublished. | |
| DraftVersionId | uuid | The version Employees are editing. Saving writes here; Publish copies it to a new immutable version and moves PublishedVersionId. | |
| DraftPreviewToken | text | not null | Opaque; the Astro app renders the draft when ?preview=<token> matches. Rotated on Publish. |
| SeoTitle | character varying(120) | ||
| SeoDescription | character varying(320) | ||
| CreatedAt | timestamp with time zone | not null | |
| ModifiedAt | timestamp with time zone | ||
| IsDeleted | boolean | not null | |
| DeletedAt | timestamp with time zone |
Indexes (3)
(CompanyId)unique (IX_Sites_CompanyId)(Subdomain)unique (IX_Sites_Subdomain)(DraftPreviewToken)unique (IX_Sites_DraftPreviewToken)
Relationships
Companies.IdreferencesSitesSiteVersions.IdreferencesSitesSiteVersions.IdreferencesSitesSiteVersions.SiteIdreferencesSitesSiteDomains.SiteIdreferencesSites