1
0
mirror of https://github.com/bitwarden/server synced 2025-12-27 05:33:17 +00:00

[PM-22974] Cascade delete NotificationStatus entities (#6011)

* cascade delete NotificationStatus entities

* add userId to test for foreign constraint

* add missing properties for Notification

* add check for foreign key
This commit is contained in:
Nick Krantz
2025-06-27 11:17:47 -05:00
committed by GitHub
parent 290fa3ded4
commit 8bccf255c0
5 changed files with 45 additions and 3 deletions

View File

@@ -5,11 +5,10 @@ CREATE TABLE [dbo].[NotificationStatus]
[ReadDate] DATETIME2 (7) NULL,
[DeletedDate] DATETIME2 (7) NULL,
CONSTRAINT [PK_NotificationStatus] PRIMARY KEY CLUSTERED ([NotificationId] ASC, [UserId] ASC),
CONSTRAINT [FK_NotificationStatus_Notification] FOREIGN KEY ([NotificationId]) REFERENCES [dbo].[Notification] ([Id]),
CONSTRAINT [FK_NotificationStatus_Notification] FOREIGN KEY ([NotificationId]) REFERENCES [dbo].[Notification] ([Id]) ON DELETE CASCADE,
CONSTRAINT [FK_NotificationStatus_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([Id])
);
GO
CREATE NONCLUSTERED INDEX [IX_NotificationStatus_UserId]
ON [dbo].[NotificationStatus]([UserId] ASC);