Clean error alerts and harden startup migration

This commit is contained in:
2026-04-11 18:07:20 +02:00
parent b52371ea79
commit 48cd83b442
5 changed files with 47 additions and 14 deletions
+8 -2
View File
@@ -60,11 +60,17 @@ builder.Services.AddDbContext<JobTrackerContext>((sp, options) =>
// Avoid ServerVersion.AutoDetect here because it forces an immediate DB connection
// during service registration, which can crash the API if MariaDB is temporarily
// unavailable or on a different network during deploy startup.
options.UseMySql(cs, new MariaDbServerVersion(new Version(11, 0, 0)));
options.UseMySql(cs, new MariaDbServerVersion(new Version(11, 0, 0)), mysql =>
{
mysql.MigrationsAssembly("JobTrackerApi");
});
}
else
{
options.UseSqlite(cs);
options.UseSqlite(cs, sqlite =>
{
sqlite.MigrationsAssembly("JobTrackerApi");
});
}
// We create Identity tables on startup in environments where `dotnet ef` isn't available.