From 73ed952ded30a23db04ce6000c2575284f99b6b9 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Mon, 26 Oct 2026 22:05:07 +0200 Subject: [PATCH] Keeps SQLite migration temporary storage in memory --- src/Lumina.Presentation.Api/Program.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Lumina.Presentation.Api/Program.cs b/src/Lumina.Presentation.Api/Program.cs index ef9ecbbc..8f1d048e 100644 --- a/src/Lumina.Presentation.Api/Program.cs +++ b/src/Lumina.Presentation.Api/Program.cs @@ -94,7 +94,19 @@ public class Program try { LuminaDbContext context = services.GetRequiredService(); - await context.Database.MigrateAsync(); + // Migrations can need a temporary store for an update or a table rebuild. The process can run in an environment whose + // temporary directory is missing or read-only, so the migration connection keeps the temporary store in memory instead + // of failing with SQLite error 14 while it tries to create a temporary file. + await context.Database.OpenConnectionAsync(); + try + { + await context.Database.ExecuteSqlRawAsync("PRAGMA temp_store = MEMORY;"); + await context.Database.MigrateAsync(); + } + finally + { + await context.Database.CloseConnectionAsync(); + } // Enable the Write-Ahead Logging journal mode and a busy timeout, so that the Entity Framework connection and the dedicated connections // used by the bulk data access operations of Dapper can access the database concurrently, without database locking errors.