mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 16:11:10 +00:00
Keeps SQLite migration temporary storage in memory
This commit is contained in:
1 parent
02bcf91661
commit
73ed952ded
1 file changed
+12
@@ -94,7 +94,19 @@ public class Program
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
LuminaDbContext context = services.GetRequiredService<LuminaDbContext>();
|
LuminaDbContext context = services.GetRequiredService<LuminaDbContext>();
|
||||||
|
// 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();
|
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
|
// 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.
|
// used by the bulk data access operations of Dapper can access the database concurrently, without database locking errors.
|
||||||
|
|||||||
Reference in new issue
Block a user