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)

Columns of the DataScopes table
ColumnTypeConstraintsDescription
Iduuidprimary key, not null
Keycharacter varying(100)not nullStable machine name, e.g. `activity.steps`, `body.weight`, `nutrition.meal_logs`. Referenced in code — never renamed, only deprecated.
Categorytextnot null`DataScopeCategory`.
Sensitivitytextnot null`DataScopeSensitivity`.
DisplayNamecharacter varying(200)not nullClient-facing: "Daily step count".
Descriptioncharacter varying(1000)not nullClient-facing plain English: exactly what the coach will see.
BackingTablescharacter varying(500)not nullComma-separated tables this scope authorises, e.g. "DeviceHealthData,HealthMetricAggregations". Documentation AND the enforcement lookup.
MaxHistoryWindowDaysintegerCeiling on how far back any grant may reach. Null = unlimited.
IsDeprecatedbooleannot null
SortOrderintegernot null
CreatedAttimestamp with time zonenot null
ModifiedAttimestamp with time zone
IsDeletedbooleannot null
DeletedAttimestamp with time zone

Indexes (2)

  • (Key) unique (IX_DataScopes_Key)
  • (Category, SortOrder) (IX_DataScopes_Category_SortOrder)

Relationships