This commit is contained in:
6d486f49
2026-08-17 01:13:48 -04:00
parent 1d6207fbfe
commit ffaab59585
26 changed files with 3133 additions and 105 deletions
+20
View File
@@ -1,4 +1,5 @@
using DatabaseTest.Components;
using DatabaseTest.Models;
using DatabaseTest.Services;
var builder = WebApplication.CreateBuilder(args);
@@ -12,6 +13,25 @@ builder.Services.AddScoped<IDatabaseService, DatabaseService>();
var app = builder.Build();
try
{
using var scope = app.Services.CreateScope();
var configService = scope.ServiceProvider.GetRequiredService<IDatabaseConfigService>();
var dbService = scope.ServiceProvider.GetRequiredService<IDatabaseService>();
if (configService.ProviderType == DatabaseProviderType.PostgreSQL)
{
_ = dbService.ApplyMigrationsAsync();
}
else
{
_ = dbService.EnsureDatabaseCreatedAsync();
}
}
catch
{
// Ignore if database is temporarily offline on startup
}
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{