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(); }