mirror of
https://github.com/zadam/trilium.git
synced 2025-10-31 18:36:30 +01:00
moving isErased into entity_changes
This commit is contained in:
@@ -22,8 +22,8 @@ function insertEntityChange(entityName, entityId, hash, sourceId = null, isSynce
|
||||
return entityChange;
|
||||
}
|
||||
|
||||
function addEntityChange(entityName, entityId, hash, sourceId, isSynced) {
|
||||
const sync = insertEntityChange(entityName, entityId, hash, sourceId, isSynced);
|
||||
function addEntityChange(entityChange, sourceId, isSynced) {
|
||||
const sync = insertEntityChange(entityChange.entityName, entityChange.entityId, entityChange.hash, sourceId, isSynced);
|
||||
|
||||
cls.addSyncRow(sync);
|
||||
}
|
||||
@@ -59,7 +59,9 @@ function cleanupSyncRowsForMissingEntities(entityName, entityPrimaryKey) {
|
||||
sql.execute(`
|
||||
DELETE
|
||||
FROM entity_changes
|
||||
WHERE sync.entityName = '${entityName}'
|
||||
WHERE
|
||||
isErased = 0
|
||||
AND sync.entityName = '${entityName}'
|
||||
AND sync.entityId NOT IN (SELECT ${entityPrimaryKey} FROM ${entityName})`);
|
||||
}
|
||||
|
||||
@@ -101,7 +103,7 @@ function fillEntityChanges(entityName, entityPrimaryKey, condition = '') {
|
||||
|
||||
function fillAllEntityChanges() {
|
||||
sql.transactional(() => {
|
||||
sql.execute("DELETE FROM entity_changes");
|
||||
sql.execute("DELETE FROM entity_changes WHERE isErased = 0");
|
||||
|
||||
fillEntityChanges("notes", "noteId");
|
||||
fillEntityChanges("note_contents", "noteId");
|
||||
|
||||
Reference in New Issue
Block a user