mirror of
https://github.com/zadam/trilium.git
synced 2025-11-05 04:45:47 +01:00
fix note revision's isErased initial value after migration
This commit is contained in:
@@ -334,6 +334,27 @@ async function findLogicIssues() {
|
||||
AND content IS NOT NULL`,
|
||||
({noteId}) => `Note ${noteId} content is not null even though the note is erased`);
|
||||
|
||||
await findAndFixIssues(`
|
||||
SELECT noteId, noteRevisionId
|
||||
FROM notes
|
||||
JOIN note_revisions USING(noteId)
|
||||
WHERE
|
||||
notes.isErased = 1
|
||||
AND note_revisions.isErased = 0`,
|
||||
async ({noteId, noteRevisionId}, autoFix) => {
|
||||
if (autoFix) {
|
||||
const noteRevision = await repository.getNoteRevision(noteRevisionId);
|
||||
noteRevision.isErased = true;
|
||||
await noteRevision.setContent(null);
|
||||
await noteRevision.save();
|
||||
|
||||
logFix(`Note revision ${noteRevisionId} has been erased since its note ${noteId} is also erased.`);
|
||||
}
|
||||
else {
|
||||
logError(`Note revision ${noteRevisionId} is not erased even though note ${noteId} is erased.`);
|
||||
}
|
||||
});
|
||||
|
||||
await findAndFixIssues(`
|
||||
SELECT noteRevisionId
|
||||
FROM note_revisions
|
||||
|
||||
Reference in New Issue
Block a user