DataScopes table
The DataScopes table in the FitStack - V2 schema has 14 columns, keyed by Id. 3 columns in CoachAccessRequestScopes, CoachAccessGrantScopes and CoachDataAccessLogs reference it.
Seeded reference data — a `DataScopeSeeder` alongside RoleSeeder. A row here is a promise to the client about what a coach can see, so the vocabulary is data, not an enum: adding a scope must not require a deployment, and deprecating one must not orphan existing grants. Suggested initial seed: activity.summary, activity.steps, activity.heart_rate, body.weight, body.composition, body.measurements (all Sensitive), nutrition.meal_logs, nutrition.macros, training.workout_logs, training.program_adherence, sleep.summary, goals.progress, schedule.planned_items
Columns (14)
| Column | Type | Constraints | Description |
|---|---|---|---|
| Id | uuid | primary key, not null | |
| Key | character varying(100) | not null | Stable machine name, e.g. `activity.steps`, `body.weight`, `nutrition.meal_logs`. Referenced in code — never renamed, only deprecated. |
| Category | text | not null | `DataScopeCategory`. |
| Sensitivity | text | not null | `DataScopeSensitivity`. |
| DisplayName | character varying(200) | not null | Client-facing: "Daily step count". |
| Description | character varying(1000) | not null | Client-facing plain English: exactly what the coach will see. |
| BackingTables | character varying(500) | not null | Comma-separated tables this scope authorises, e.g. "DeviceHealthData,HealthMetricAggregations". Documentation AND the enforcement lookup. |
| MaxHistoryWindowDays | integer | Ceiling on how far back any grant may reach. Null = unlimited. | |
| IsDeprecated | boolean | not null | |
| SortOrder | integer | not null | |
| CreatedAt | timestamp with time zone | not null | |
| ModifiedAt | timestamp with time zone | ||
| IsDeleted | boolean | not null | |
| DeletedAt | timestamp with time zone |
Indexes (2)
(Key)unique (IX_DataScopes_Key)(Category, SortOrder)(IX_DataScopes_Category_SortOrder)
Relationships
CoachAccessRequestScopes.DataScopeIdreferencesDataScopesCoachAccessGrantScopes.DataScopeIdreferencesDataScopesCoachDataAccessLogs.DataScopeIdreferencesDataScopes