Добавлен папаметр forceAutoRepair

This commit is contained in:
Book Pauk
2021-12-03 14:21:50 +07:00
parent 3d2f45c20d
commit 9ec74eccb4
2 changed files with 3 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ class JembaConnManager {
return instance;
}
async init(config, migs = jembaMigrations, undoLastMigration = false) {
async init(config, forceAutoRepair = false, migs = jembaMigrations, undoLastMigration = false) {
if (this.inited)
throw new Error('JembaConnManager initialized already');
@@ -52,7 +52,7 @@ class JembaConnManager {
try {
await dbConn.openAll();
} catch(e) {
if (dbConfig.autoRepair &&
if ((forceAutoRepair || dbConfig.autoRepair) &&
(
e.message.indexOf('corrupted') >= 0
|| e.message.indexOf('Unexpected token') >= 0