Clean error alerts and harden startup migration
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user