fix(database): qualify RD21 saves against pinned MariaDB 12.2.2

This commit is contained in:
cesnimda
2026-10-24 01:47:50 +02:00
parent 0d16a691e0
commit a2c9bda0d1
30 changed files with 2226 additions and 63 deletions
@@ -264,8 +264,8 @@ public static class StartupInitializationExtensions
var paths = scope.ServiceProvider.GetRequiredService<AppPaths>();
var users = scope.ServiceProvider.GetRequiredService<UserManager<ApplicationUser>>();
var roles = scope.ServiceProvider.GetRequiredService<RoleManager<IdentityRole>>();
var provider = (app.Configuration["Database:Provider"] ?? "sqlite").Trim().ToLowerInvariant();
var useSqliteBootstrap = provider is not "mysql" and not "mariadb";
var provider = DatabaseConfiguration.GetProvider(app.Configuration);
var useSqliteBootstrap = provider == "sqlite";
// Reconciliation opens the file before EF creates it; enable WAL explicitly so readers do not block commits.
if (useSqliteBootstrap) db.Database.ExecuteSqlRaw("PRAGMA journal_mode = WAL;");
@@ -519,6 +519,9 @@ public static class StartupInitializationExtensions
// Correspondences/Attachments) -- re-run once more after Migrate() below via
// ReconcileCoreAppColumnsMySql, in case this is a brand-new database.
ReconcileCoreAppColumnsMySql(conn);
EnsureMySqlColumn(conn, "AspNetUsers", "FirstName", "ALTER TABLE `AspNetUsers` ADD COLUMN `FirstName` longtext NULL;");
EnsureMySqlColumn(conn, "AspNetUsers", "LastName", "ALTER TABLE `AspNetUsers` ADD COLUMN `LastName` longtext NULL;");
EnsureMySqlColumn(conn, "AspNetUsers", "DisplayName", "ALTER TABLE `AspNetUsers` ADD COLUMN `DisplayName` longtext NULL;");
EnsureMySqlColumn(conn, "AspNetUsers", "ProfileCvText", "ALTER TABLE `AspNetUsers` ADD COLUMN `ProfileCvText` longtext NULL;");
EnsureMySqlColumn(conn, "AspNetUsers", "ProfileCvStructureJson", "ALTER TABLE `AspNetUsers` ADD COLUMN `ProfileCvStructureJson` longtext NULL;");
EnsureMySqlColumn(conn, "AspNetUsers", "CurrentCvUploadArtifactId", "ALTER TABLE `AspNetUsers` ADD COLUMN `CurrentCvUploadArtifactId` int NULL;");
@@ -848,7 +851,7 @@ public static class StartupInitializationExtensions
using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<JobTrackerContext>();
var runtimeProvider = (app.Configuration["Database:Provider"] ?? "sqlite").Trim().ToLowerInvariant();
var runtimeProvider = DatabaseConfiguration.GetProvider(app.Configuration);
using var conn = db.Database.GetDbConnection();
conn.Open();
if (!CoreSchemaReady(conn, runtimeProvider))