UserPermissions table
The UserPermissions table in the FitStack - V2 schema has 5 columns, keyed by Id, with 2 foreign keys to Users and Permissions.
Direct user grant, bypassing roles. C# class is `UserPermission`; the table is `UserPermissions`. **Missing dimensions, by design:** there is no subject ("on whose data"), no expiry, and no revocation record — only `GrantedAt`. Adding those here would make one table mean two different things, so scoped coach access lives in its own tables. Also missing: a unique index on `(UserId, PermissionId)`, so the same grant can be inserted twice.
Columns (5)
| Column | Type | Constraints | Description |
|---|---|---|---|
| Id | uuid | primary key, not null | |
| UserId | text | not null, references Users.Id | |
| PermissionId | uuid | not null, references Permissions.Id | |
| GrantedAt | timestamp with time zone | not null | |
| GrantedBy | text | Granting user id. Deliberately NOT an FK today. |
Indexes (2)
(UserId)(IX_UserPermissions_UserId)(PermissionId)(IX_UserPermissions_PermissionId)
Relationships
UserPermissions.UserIdreferencesUsers.IdUserPermissions.PermissionIdreferencesPermissions.Id