From 80e2f3950351be3cdadab13930a4d0b98c45d0e6 Mon Sep 17 00:00:00 2001 From: JamesPasta Date: Wed, 25 Mar 2026 15:49:37 -0700 Subject: [PATCH] feature/AB#32437-EditPrompts-FixDBMigration --- .../DataSeed/AIPromptDataSeeder.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/applications/Unity.GrantManager/modules/Unity.AI/src/Unity.AI.Application/DataSeed/AIPromptDataSeeder.cs b/applications/Unity.GrantManager/modules/Unity.AI/src/Unity.AI.Application/DataSeed/AIPromptDataSeeder.cs index b0ed0cb95..dc0edc9a7 100644 --- a/applications/Unity.GrantManager/modules/Unity.AI/src/Unity.AI.Application/DataSeed/AIPromptDataSeeder.cs +++ b/applications/Unity.GrantManager/modules/Unity.AI/src/Unity.AI.Application/DataSeed/AIPromptDataSeeder.cs @@ -6,6 +6,7 @@ using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories; +using Volo.Abp.MultiTenancy; namespace Unity.AI.DataSeed; @@ -17,7 +18,8 @@ namespace Unity.AI.DataSeed; /// public class AIPromptDataSeeder( IRepository promptRepository, - IRepository versionRepository) : IDataSeedContributor, ITransientDependency + IRepository versionRepository, + ICurrentTenant currentTenant) : IDataSeedContributor, ITransientDependency { // Fixed deterministic GUIDs — never change these; they ensure idempotent re-seeding private static readonly Guid AnalysisPromptId = new("4a100001-1000-4000-a000-000000000001"); @@ -28,9 +30,12 @@ public async Task SeedAsync(DataSeedContext context) { if (context.TenantId != null) return; // host database only - await SeedAnalysisPromptAsync(); - await SeedAttachmentPromptAsync(); - await SeedScoresheetPromptAsync(); + using (currentTenant.Change(null)) + { + await SeedAnalysisPromptAsync(); + await SeedAttachmentPromptAsync(); + await SeedScoresheetPromptAsync(); + } } // ─── ANALYSIS ────────────────────────────────────────────────────────────