Skip to content

StudioNotificationService — DDL appendix

Generated from the architecture model

This page is rendered from model/**/*.yaml by tools/docs_model during mkdocs build. Edit the YAML, not this page; hand-written design lives on the linked service, platform and plane pages.

Dialect shown: SQL Server (nvarchar, uniqueidentifier, datetimeoffset). Migrations are authored as FluentMigrator classes in the service's DatabaseModel.Migrations project; the TenantId column and the NHibernate tenant filter follow canonical ADR-0100 in SharedDb mode.

dbo.Notifications

Owner: Notification · Retention: 90 days

CREATE TABLE [dbo].[Notifications] (
    [NotificationId] uniqueidentifier NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [UserId] nvarchar(128) NOT NULL,
    [Kind] int NOT NULL,
    [SubjectRef] nvarchar(256) NOT NULL,
    [ProjectId] nvarchar(64) NULL,
    [Importance] nvarchar(16) NOT NULL,
    [Summary] nvarchar(512) NOT NULL,
    [ReadAt] datetimeoffset NULL,
    [DismissedAt] datetimeoffset NULL,
    [DeliveriesJson] nvarchar(2000) NOT NULL,
    [CreatedAt] datetimeoffset NOT NULL,
    CONSTRAINT [PK_Notifications] PRIMARY KEY ([NotificationId])
);
CREATE INDEX [IX_Notifications_User_Unread] ON [dbo].[Notifications] ([TenantId], [UserId], [ReadAt], [CreatedAt]);
Column Type Null Key Description
NotificationId uniqueidentifier no PK
TenantId nvarchar(64) no
UserId nvarchar(128) no
Kind int no
SubjectRef nvarchar(256) no
ProjectId nvarchar(64) yes
Importance nvarchar(16) no
Summary nvarchar(512) no
ReadAt datetimeoffset yes
DismissedAt datetimeoffset yes
DeliveriesJson nvarchar(2000) no
CreatedAt datetimeoffset no

dbo.NotificationPreferences

Owner: NotificationPreference

CREATE TABLE [dbo].[NotificationPreferences] (
    [UserId] nvarchar(128) NOT NULL,
    [TenantId] nvarchar(64) NOT NULL,
    [ChannelsByKindJson] nvarchar(2000) NOT NULL,
    [QuietHoursJson] nvarchar(256) NULL,
    [Digest] nvarchar(8) NOT NULL DEFAULT ('none'),
    CONSTRAINT [PK_NotificationPreferences] PRIMARY KEY ([UserId], [TenantId])
);
Column Type Null Key Description
UserId nvarchar(128) no PK
TenantId nvarchar(64) no PK
ChannelsByKindJson nvarchar(2000) no
QuietHoursJson nvarchar(256) yes
Digest nvarchar(8) no