diff --git a/src/Basisregisters.IntegrationDb.SuspiciousCases.Api/Infrastructure/Startup.cs b/src/Basisregisters.IntegrationDb.SuspiciousCases.Api/Infrastructure/Startup.cs index b8f6f7b..06f116c 100644 --- a/src/Basisregisters.IntegrationDb.SuspiciousCases.Api/Infrastructure/Startup.cs +++ b/src/Basisregisters.IntegrationDb.SuspiciousCases.Api/Infrastructure/Startup.cs @@ -3,6 +3,7 @@ namespace Basisregisters.IntegrationDb.SuspiciousCases.Api.Infrastructure using System; using System.Linq; using System.Reflection; + using System.Threading.Tasks; using Abstractions; using Asp.Versioning.ApiExplorer; using Autofac; @@ -164,9 +165,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(); }