mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
fix migration
This commit is contained in:
parent
0758c82983
commit
c177d2b97b
@ -1,12 +1,12 @@
|
|||||||
-- case based on isDeleted is needed, otherwise 2 branches (1 deleted, 1 not) might get the same ID
|
-- 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((
|
||||||
SELECT
|
SELECT
|
||||||
CASE isDeleted
|
CASE isDeleted
|
||||||
WHEN 0 THEN parentNoteId || '_' || noteId
|
WHEN 0 THEN parentNoteId || '_' || noteId
|
||||||
WHEN 1 THEN branchId
|
WHEN 1 THEN branchId
|
||||||
END
|
END
|
||||||
FROM branches WHERE branchId = entityId
|
FROM branches WHERE branchId = entityId
|
||||||
)
|
), entityId)
|
||||||
WHERE entityName = 'branches';
|
WHERE entityName = 'branches' AND isErased = 0;
|
||||||
|
|
||||||
UPDATE branches SET branchId = parentNoteId || '_' || noteId WHERE isDeleted = 0;
|
UPDATE branches SET branchId = parentNoteId || '_' || noteId WHERE isDeleted = 0;
|
||||||
|
@ -62,9 +62,10 @@ async function migrate() {
|
|||||||
log.info(`Migration to version ${mig.dbVersion} has been successful.`);
|
log.info(`Migration to version ${mig.dbVersion} has been successful.`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.error(`error during migration to version ${mig.dbVersion}: ${e.stack}`);
|
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();
|
utils.crash();
|
||||||
|
break; // crash() above does not seem to work right away
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user