Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix migration
zadamc177d2b97b35
diff --git a/db/migrations/0211__rename_branchIds.sql b/db/migrations/0211__rename_branchIds.sqlindex a5dd8a5d37..be18ec00ce 100644--- a/db/migrations/0211__rename_branchIds.sql+++ b/db/migrations/0211__rename_branchIds.sql@@ -1,12 +1,12 @@-- case based on isDeleted is needed, otherwise 2 branches (1 deleted, 1 not) might get the same ID-UPDATE entity_changes SET entityId = (+UPDATE entity_changes SET entityId = COALESCE((SELECTCASE isDeletedWHEN 0 THEN parentNoteId || '_' || noteIdWHEN 1 THEN branchIdENDFROM branches WHERE branchId = entityId-)-WHERE entityName = 'branches';+), entityId)+WHERE entityName = 'branches' AND isErased = 0;UPDATE branches SET branchId = parentNoteId || '_' || noteId WHERE isDeleted = 0;diff --git a/src/services/migration.js b/src/services/migration.jsindex a9e5d17992..f73b0f3e23 100644--- a/src/services/migration.js+++ b/src/services/migration.js@@ -62,9 +62,10 @@ async function migrate() {log.info(`Migration to version ${mig.dbVersion} has been successful.`);} catch (e) {log.error(`error during migration to version ${mig.dbVersion}: ${e.stack}`);- log.error("migration failed, crashing hard"); // this is not very user friendly :-/+ log.error("migration failed, crashing hard"); // this is not very user-friendly :-/utils.crash();+ break; // crash() above does not seem to work right away}}});