-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ac/pm-15621/refactor-delete-command
- Loading branch information
Showing
16 changed files
with
9,330 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/Infrastructure.EntityFramework/NotificationCenter/Models/Notification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
util/Migrator/DbScripts/2025-02-07_00_AddOptionalNotificationTaskId.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
-- Add optional TaskId column to Notification table | ||
IF COL_LENGTH('[dbo].[Notification]', 'TaskId') IS NULL | ||
BEGIN | ||
ALTER TABLE [dbo].[Notification] | ||
ADD [TaskId] UNIQUEIDENTIFIER NULL | ||
|
||
ALTER TABLE [dbo].[Notification] | ||
ADD CONSTRAINT [FK_Notification_SecurityTask] FOREIGN KEY ([TaskId]) REFERENCES [dbo].[SecurityTask] ([Id]) | ||
END | ||
GO | ||
|
||
IF NOT EXISTS (SELECT * | ||
FROM sys.indexes | ||
WHERE name = 'IX_Notification_TaskId') | ||
BEGIN | ||
CREATE NONCLUSTERED INDEX [IX_Notification_TaskId] | ||
ON [dbo].[Notification] ([TaskId] ASC) WHERE TaskId IS NOT NULL; | ||
END | ||
GO | ||
|
||
-- Alter Notification_Create and Notification_Update stored procedures to include TaskId | ||
CREATE OR ALTER PROCEDURE [dbo].[Notification_Create] | ||
@Id UNIQUEIDENTIFIER OUTPUT, | ||
@Priority TINYINT, | ||
@Global BIT, | ||
@ClientType TINYINT, | ||
@UserId UNIQUEIDENTIFIER, | ||
@OrganizationId UNIQUEIDENTIFIER, | ||
@Title NVARCHAR(256), | ||
@Body NVARCHAR(MAX), | ||
@CreationDate DATETIME2(7), | ||
@RevisionDate DATETIME2(7), | ||
@TaskId UNIQUEIDENTIFIER = NULL | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON | ||
|
||
INSERT INTO [dbo].[Notification] ( | ||
[Id], | ||
[Priority], | ||
[Global], | ||
[ClientType], | ||
[UserId], | ||
[OrganizationId], | ||
[Title], | ||
[Body], | ||
[CreationDate], | ||
[RevisionDate], | ||
[TaskId] | ||
) | ||
VALUES ( | ||
@Id, | ||
@Priority, | ||
@Global, | ||
@ClientType, | ||
@UserId, | ||
@OrganizationId, | ||
@Title, | ||
@Body, | ||
@CreationDate, | ||
@RevisionDate, | ||
@TaskId | ||
) | ||
END | ||
GO | ||
|
||
CREATE OR ALTER PROCEDURE [dbo].[Notification_Update] | ||
@Id UNIQUEIDENTIFIER, | ||
@Priority TINYINT, | ||
@Global BIT, | ||
@ClientType TINYINT, | ||
@UserId UNIQUEIDENTIFIER, | ||
@OrganizationId UNIQUEIDENTIFIER, | ||
@Title NVARCHAR(256), | ||
@Body NVARCHAR(MAX), | ||
@CreationDate DATETIME2(7), | ||
@RevisionDate DATETIME2(7), | ||
@TaskId UNIQUEIDENTIFIER = NULL | ||
AS | ||
BEGIN | ||
SET NOCOUNT ON | ||
|
||
UPDATE [dbo].[Notification] | ||
SET [Priority] = @Priority, | ||
[Global] = @Global, | ||
[ClientType] = @ClientType, | ||
[UserId] = @UserId, | ||
[OrganizationId] = @OrganizationId, | ||
[Title] = @Title, | ||
[Body] = @Body, | ||
[CreationDate] = @CreationDate, | ||
[RevisionDate] = @RevisionDate, | ||
[TaskId] = @TaskId | ||
WHERE [Id] = @Id | ||
END | ||
GO | ||
|
||
-- Recreate NotificationView | ||
CREATE OR ALTER VIEW [dbo].[NotificationView] | ||
AS | ||
SELECT | ||
* | ||
FROM | ||
[dbo].[Notification] | ||
GO | ||
|
||
|
Oops, something went wrong.