From 040d9535af23aaf6819cb7d0fe6feef36881e0af Mon Sep 17 00:00:00 2001 From: ArneD Date: Thu, 21 Nov 2024 11:02:35 +0100 Subject: [PATCH] fix(suspicious): api run migrations async --- .../Infrastructure/Startup.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Basisregisters.IntegrationDb.SuspiciousCases.Api/Infrastructure/Startup.cs b/src/Basisregisters.IntegrationDb.SuspiciousCases.Api/Infrastructure/Startup.cs index b8f6f7b..68f9d9e 100644 --- a/src/Basisregisters.IntegrationDb.SuspiciousCases.Api/Infrastructure/Startup.cs +++ b/src/Basisregisters.IntegrationDb.SuspiciousCases.Api/Infrastructure/Startup.cs @@ -164,9 +164,12 @@ public void Configure( } }); - MigrationsHelper.Run( - _configuration.GetConnectionString("Integration"), - serviceProvider.GetService()); + appLifetime.ApplicationStarted.Register(() => + { + MigrationsHelper.Run( + _configuration.GetConnectionString("Integration"), + serviceProvider.GetService()); + }); StartupHelpers.CheckDatabases(healthCheckService, DatabaseTag, loggerFactory).GetAwaiter().GetResult(); }