Notifications table
The Notifications table in the FitStack - V2 schema has 19 columns, keyed by Id, with 2 foreign keys to Users and NotificationGroups.
The coaching domain needs five new `Type` values. Because `Type` is free text, adding them costs nothing here — but each one also wants a delivery-preference column on `NotificationSettings` (04), which IS a migration: CoachInvitationReceived — a coach invited you / a client requested you CoachAccessRequested — a coach is asking to view your data << the consent prompt CoachAccessDecision — your client granted or denied access CoachAccessRevoked — a client withdrew consent CoachCheckInDue — a check-in is due `NotificationType.Achievement` (ordinal 6) is a permanent gap after the achievements removal; Warning is 7.
Columns (19)
| Column | Type | Constraints | Description |
|---|---|---|---|
| Id | uuid | primary key, not null | |
| UserId | character varying(450) | not null, references Users.Id | CASCADE. |
| NotificationGroupId | uuid | references NotificationGroups.Id | SET NULL. |
| Type | character varying(100) | not null | FREE-TEXT type name, not an enum column. The C# NotificationType enum (~40 members) is written in as a string. |
| Title | character varying(200) | not null | |
| Body | character varying(500) | not null | |
| ImageUrl | character varying(500) | ||
| IsRead | boolean | not null | |
| ReadAt | timestamp with time zone | ||
| GroupKey | character varying(100) | ||
| RelatedEntityId | uuid | POLYMORPHIC — no FK. | |
| RelatedEntityType | character varying(50) | ||
| ActionUrl | character varying(500) | ||
| Metadata | text | ||
| ExpiresAt | timestamp with time zone | ||
| CreatedAt | timestamp with time zone | not null | |
| ModifiedAt | timestamp with time zone | ||
| IsDeleted | boolean | not null | |
| DeletedAt | timestamp with time zone |
Indexes (4)
(UserId, CreatedAt)(IX_Notifications_UserId_CreatedAt)(UserId, IsRead)(IX_Notifications_UserId_IsRead)(GroupKey)(IX_Notifications_GroupKey)(ExpiresAt)(IX_Notifications_ExpiresAt)
Relationships
Notifications.UserIdreferencesUsers.IdNotifications.NotificationGroupIdreferencesNotificationGroups.Id