diff --git a/src/store/database.ts b/src/store/database.ts --- a/src/store/database.ts +++ b/src/store/database.ts @@ -38,7 +38,8 @@ const MIGRATIONS: string[] = [ ]; export function openDatabase(path: string): DatabaseSync { - const db = new DatabaseSync(path); + // Si otra conexión tiene el lock, esperar hasta 5 s en vez de fallar enseguida. + const db = new DatabaseSync(path, { timeout: 5000 }); // SQLite no revisa las claves foráneas si no se le pide en cada conexión. db.exec('PRAGMA foreign_keys = ON'); migrate(db);