Skip to main content

Notification Schema Reference

Summary

The authoritative schema reference. 7 tables in the extracted notification schema and 3 tables in the monolith's shared schema. Each table appears exactly once, here and nowhere else in this section.

Audience

Engineers, architects, QA, support, DevOps engineers and security reviewers.

Reference Content

The verified reference material for this topic is set out in the sections below.

Conventions

Every extracted table has a single GUID primary key named Id, assigned client-side. Lengths are the mapped maximums. "Required" means the mapping marks the property required; every other string column is nullable. No table declares a foreign key, check constraint, default constraint or concurrency token.

Extracted schema — notification

1. NotificationTemplates

ColumnTypeNotes
IdGUIDPrimary key
TenantIdstring(80)Null denotes a global default
TemplateKeystring(160)Required
Channelstring(40)Required
VersionintMonotonic per tenant, key and channel
SubjectTemplatestring(1000)
BodyTemplatetextUnbounded
Localestring(35)
IsActivebool
Descriptionstring(500)
CreatedOnUtctimestamp
UpdatedOnUtctimestamp

Indexes: UX_Templates_Tenant_Key_Channel_Version (unique), IX_Templates_Key_Channel.

2. NotificationRecipients

ColumnTypeNotes
IdGUIDPrimary key
TenantIdstring(80)
RecipientTypestring(40)Required
ExternalRefstring(200)Required
DisplayNamestring(300)
Emailstring(320)
Phonestring(40)
CreatedOnUtctimestamp
UpdatedOnUtctimestamp

Indexes: UX_Recipients_Tenant_Type_Ref (unique).

3. NotificationMessages

ColumnTypeNotes
IdGUIDPrimary key
TenantIdstring(80)
EventIdGUID?Null for API-originated sends
EventTypestring(160)
CorrelationIdstring(160)
TemplateKeystring(160)Required
TemplateIdGUID?Unenforced reference
TemplateVersionint
Channelstring(40)Required
RecipientIdGUIDUnenforced reference
ToAddressstring(320)
Subjectstring(1000)
BodytextUnbounded
Statusstring(40)Required
Attemptsint
LastErrorstring(2000)
CreatedOnUtctimestamp
SentOnUtctimestamp?
ReadOnUtctimestamp?

Indexes: IX_Messages_Recipient_Status, IX_Messages_Tenant_Channel, IX_Messages_EventId.

4. NotificationDeliveryAttempts

ColumnTypeNotes
IdGUIDPrimary key
NotificationMessageIdGUIDUnenforced reference
AttemptNumberintOne-based
Channelstring(40)Required
Providerstring(60)Required
Statusstring(40)Required
Errorstring(2000)Truncated in application code
StartedOnUtctimestamp
CompletedOnUtctimestamp
DurationMslong

Indexes: IX_DeliveryAttempts_MessageId. The only table with no tenant column.

5. NotificationPreferences

ColumnTypeNotes
IdGUIDPrimary key
TenantIdstring(80)
RecipientTypestring(40)Required
ExternalRefstring(200)Required
EventTypestring(160)Required; * means all events
Channelstring(40)Required
Enabledbool
CreatedOnUtctimestamp
UpdatedOnUtctimestamp

Indexes: UX_Preferences_Scope (unique, five columns). No runtime write path exists.

6. NotificationAuditLog

ColumnTypeNotes
IdGUIDPrimary key
TenantIdstring(80)
EventIdGUID?
NotificationMessageIdGUID?Null for event-level stages
EventTypestring(160)
Stagestring(40)Required
Detailstring(2000)Truncated in application code
CorrelationIdstring(160)
TraceIdstring(64)
OccurredOnUtctimestamp

Indexes: IX_Audit_EventId, IX_Audit_MessageId, IX_Audit_Correlation, IX_Audit_OccurredOn.

7. ProcessedIntegrationEvents

ColumnTypeNotes
IdGUIDPrimary key
EventIdGUIDUniquely indexed
EventTypestring(160)Required
TenantIdstring(80)
CorrelationIdstring(160)
SourceServicestring(120)
Outcomestring(40)Required
MessagesCreatedint
ProcessedOnUtctimestamp

Indexes: UX_ProcessedEvents_EventId (unique), IX_ProcessedEvents_Correlation.

Monolith schema — legacy notification tables

8. Notifications

Integer identity key. Columns: user, employee and labor references, event key (max length 120), title (max length 220), message, action URL (max length 500), read flag, creation timestamp and a nullable client tenant. Index on client tenant, user, read flag and creation timestamp. Tenant query filter applied with a super-admin bypass.

9. UserNotifications

Integer identity key. Columns: user reference, title, message, a type value defaulting to an informational literal, action URL, read flag, creation timestamp and a nullable client tenant. Tenant query filter applied with a super-admin bypass.

10. NotificationTemplates (legacy)

Integer identity key. Columns: event key (max length 120), title and message templates, email subject and body templates, email-enabled and in-app-enabled flags, nullable client tenant and an active flag. Index on client tenant and event key. Tenant query filter applied with a super-admin bypass that additionally admits null-tenant rows.

This table shares a name with the extracted template table but has an unrelated shape.

Totals

MetricExtractedMonolith
Tables73
Primary keys7 GUID, client-assigned3 integer identity
Indexes142
Unique constraints40
Foreign keys00
Query filters03

Classification

Transitional.

Requires confirmation

Whether the two template models are to be reconciled, and the target state for the legacy tables, require confirmation.

See Also

Keywords

  • Notification database
  • Schema Reference
  • Draft database documentation

Source References

  • microservices/src/notification-service/Infrastructure/NotificationDbContext.cs
  • microservices/src/notification-service/Domain/NotificationEntities.cs
  • microservices/src/notification-service/Infrastructure/Migrations/20260705113059_InitialNotificationSchema.cs
  • microservices/src/notification-service/Infrastructure/Migrations/NotificationDbContextModelSnapshot.cs
  • Data/AppDbContext.cs
  • Models/Notification.cs
  • Models/UserNotification.cs
  • Models/NotificationTemplate.cs

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-21
  • Review cycle: Quarterly