From d14d6510304686ed070cd95e4d68410c255eed2e Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Wed, 21 Aug 2024 11:39:19 -0700 Subject: [PATCH] Add a perf-importent Notification index (#16590) --- .../Migrations/NotificationMigrations.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Notifications/Migrations/NotificationMigrations.cs b/src/OrchardCore.Modules/OrchardCore.Notifications/Migrations/NotificationMigrations.cs index 702ed24972b..54eeef538b0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Notifications/Migrations/NotificationMigrations.cs +++ b/src/OrchardCore.Modules/OrchardCore.Notifications/Migrations/NotificationMigrations.cs @@ -29,6 +29,29 @@ await SchemaBuilder.AlterIndexTableAsync(table => table collection: NotificationConstants.NotificationCollection ); - return 1; + await SchemaBuilder.AlterIndexTableAsync(table => table + .CreateIndex("IDX_NotificationIndex_UserId", + "DocumentId", + "UserId", + "IsRead", + "CreatedAtUtc"), + collection: NotificationConstants.NotificationCollection + ); + + return 2; + } + + public async Task UpdateFrom1Async() + { + await SchemaBuilder.AlterIndexTableAsync(table => table + .CreateIndex("IDX_NotificationIndex_UserId", + "DocumentId", + "UserId", + "IsRead", + "CreatedAtUtc"), + collection: NotificationConstants.NotificationCollection + ); + + return 2; } }