mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-06-25 16:02:36 -04:00
DbContexts.GetContext() runs ApplyMigrations on every context creation, calling Database.Migrate(). Migrate() acquires the EF migration lock before checking whether anything is pending. For SQLite that lock is a persisted row in __EFMigrationsLock with no timeout (SQLite has no connection-scoped lock that frees on disconnect). A process killed after acquiring the lock but before releasing it - even during an otherwise no-op Migrate() - orphans the row, and every later Migrate() then spins forever in SqliteHistoryRepository.AcquireDatabaseLock(). The row lives in the db file, so restarts never clear it, matching the "scan hangs, reboot doesn't help" reports in #1729. Guard Migrate()/MigrateAsync() behind GetPendingMigrations(), which only reads __EFMigrationsHistory and never acquires the lock. The steady-state path (schema already current) no longer touches the lock at all; first run and real migrations are unchanged.