Skip to content

Build your personal knowledge base with Trilium Notes

fix setting isErased after note migration

zadam7bd1d8feb4b0
diff --git a/db/migrations/0151__add_isErased_to_note.sql b/db/migrations/0151__add_isErased_to_note.sql
index 57ab1985ab..9cd860697c 100644
--- a/db/migrations/0151__add_isErased_to_note.sql
+++ b/db/migrations/0151__add_isErased_to_note.sql
@@ -20,7 +20,7 @@ DROP TABLE notes;
ALTER TABLE notes_mig RENAME TO notes;
UPDATE notes SET isErased = 1 WHERE isDeleted = 1
-AND (SELECT CASE content WHEN NULL THEN 1 ELSE 0 END FROM note_contents WHERE note_contents.noteId = notes.noteId);
+AND 1=(SELECT CASE content WHEN NULL THEN 1 ELSE 0 END FROM note_contents WHERE note_contents.noteId = notes.noteId);
CREATE INDEX `IDX_notes_isDeleted` ON `notes` (`isDeleted`);
CREATE INDEX `IDX_notes_title` ON `notes` (`title`);
diff --git a/src/services/consistency_checks.js b/src/services/consistency_checks.js
index 4819b5157a..73f6725fd5 100644
--- a/src/services/consistency_checks.js
+++ b/src/services/consistency_checks.js
@@ -364,7 +364,7 @@ async function findLogicIssues() {
AND content IS NULL`,
async ({noteRevisionId}, autoFix) => {
if (autoFix) {
- const noteRevision = await repository.getNote(noteRevisionId);
+ const noteRevision = await repository.getNoteRevision(noteRevisionId);
await noteRevision.setContent('');
logFix(`Note revision ${noteRevisionId} content was set to empty string since it was null even though it is not erased`);