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)

Columns of the Notifications table
ColumnTypeConstraintsDescription
Iduuidprimary key, not null
UserIdcharacter varying(450)not null, references Users.IdCASCADE.
NotificationGroupIduuidreferences NotificationGroups.IdSET NULL.
Typecharacter varying(100)not nullFREE-TEXT type name, not an enum column. The C# NotificationType enum (~40 members) is written in as a string.
Titlecharacter varying(200)not null
Bodycharacter varying(500)not null
ImageUrlcharacter varying(500)
IsReadbooleannot null
ReadAttimestamp with time zone
GroupKeycharacter varying(100)
RelatedEntityIduuidPOLYMORPHIC — no FK.
RelatedEntityTypecharacter varying(50)
ActionUrlcharacter varying(500)
Metadatatext
ExpiresAttimestamp with time zone
CreatedAttimestamp with time zonenot null
ModifiedAttimestamp with time zone
IsDeletedbooleannot null
DeletedAttimestamp 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