From b4ac41eff8f4c36f4fd1c578fe7b47b68ea7450d Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 6 Jun 2022 21:59:44 +0200 Subject: [PATCH 1/2] fix handlers import, closes #2900 --- src/becca/entities/note.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/becca/entities/note.js b/src/becca/entities/note.js index 0a945bf0f..662a0ba78 100644 --- a/src/becca/entities/note.js +++ b/src/becca/entities/note.js @@ -9,7 +9,6 @@ const entityChangesService = require('../../services/entity_changes'); const AbstractEntity = require("./abstract_entity"); const NoteRevision = require("./note_revision"); const TaskContext = require("../../services/task_context"); -const handlers = require("../../services/handlers"); const LABEL = 'label'; const RELATION = 'relation'; @@ -1143,6 +1142,7 @@ class Note extends AbstractEntity { } // needs to be run before branches and attributes are deleted and thus attached relations disappear + const handlers = require("../../services/handlers"); handlers.runAttachedRelations(this, 'runOnNoteDeletion', this); taskContext.noteDeletionHandlerTriggered = true; From 7609bc78ec03cbf96154194e43bad217af5c1bf5 Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 6 Jun 2022 22:27:06 +0200 Subject: [PATCH 2/2] allow ignoring DB version for skipping uncritical migrations in case of a downgrade --- src/services/migration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/migration.js b/src/services/migration.js index e7306a7d0..423c87cf1 100644 --- a/src/services/migration.js +++ b/src/services/migration.js @@ -102,7 +102,7 @@ function isDbUpToDate() { async function migrateIfNecessary() { const currentDbVersion = getDbVersion(); - if (currentDbVersion > appInfo.dbVersion) { + if (currentDbVersion > appInfo.dbVersion && process.env.TRILIUM_IGNORE_DB_VERSION !== 'true') { log.error(`Current DB version ${currentDbVersion} is newer than app db version ${appInfo.dbVersion} which means that it was created by newer and incompatible version of Trilium. Upgrade to latest version of Trilium to resolve this issue.`); utils.crash();