mirror of
https://github.com/zadam/trilium.git
synced 2025-11-18 03:00:41 +01:00
erasing note revisions
This commit is contained in:
@@ -4,7 +4,7 @@ const build = require('./build');
|
||||
const packageJson = require('../../package');
|
||||
const {TRILIUM_DATA_DIR} = require('./data_dir');
|
||||
|
||||
const APP_DB_VERSION = 152;
|
||||
const APP_DB_VERSION = 153;
|
||||
const SYNC_VERSION = 11;
|
||||
const CLIPPER_PROTOCOL_VERSION = "1.0";
|
||||
|
||||
|
||||
@@ -470,11 +470,20 @@ async function eraseDeletedNotes() {
|
||||
utcDateModified = '${utcNowDateTime}'
|
||||
WHERE noteId IN (???)`, noteIdsToErase);
|
||||
|
||||
// deleting first contents since the WHERE relies on isErased = 0
|
||||
await sql.executeMany(`
|
||||
UPDATE note_revisions
|
||||
UPDATE note_revision_contents
|
||||
SET content = NULL,
|
||||
utcDateModified = '${utcNowDateTime}'
|
||||
WHERE noteId IN (???)`, noteIdsToErase);
|
||||
WHERE noteRevisionId IN
|
||||
(SELECT noteRevisionId FROM note_revisions WHERE isErased = 0 AND noteId IN ((???)))`, noteIdsToErase);
|
||||
|
||||
await sql.executeMany(`
|
||||
UPDATE note_revisions
|
||||
SET isErased = 1,
|
||||
title = NULL,
|
||||
utcDateModified = '${utcNowDateTime}'
|
||||
WHERE isErased = 0 AND noteId IN (???)`, noteIdsToErase);
|
||||
}
|
||||
|
||||
async function duplicateNote(noteId, parentNoteId) {
|
||||
|
||||
@@ -18,6 +18,9 @@ async function updateEntity(sync, entity, sourceId) {
|
||||
else if (entityName === 'note_revisions') {
|
||||
await updateNoteRevision(entity, sourceId);
|
||||
}
|
||||
else if (entityName === 'note_revision_contents') {
|
||||
await updateNoteRevisionContent(entity, sourceId);
|
||||
}
|
||||
else if (entityName === 'note_reordering') {
|
||||
await updateNoteReordering(sync.entityId, entity, sourceId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user