mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
fix sync issues
This commit is contained in:
parent
2d38706ba8
commit
48abd765c6
@ -6,8 +6,8 @@ CREATE TABLE IF NOT EXISTS "sync_mig" (
|
||||
`isSynced` INTEGER default 0 not null,
|
||||
`utcSyncDate` TEXT NOT NULL);
|
||||
|
||||
INSERT INTO sync_mig (entityName, entityId, sourceId, isSynced, utcSyncDate)
|
||||
SELECT entityName, entityId, sourceId, 1, utcSyncDate FROM sync;
|
||||
INSERT INTO sync_mig (id, entityName, entityId, sourceId, isSynced, utcSyncDate)
|
||||
SELECT id, entityName, entityId, sourceId, 1, utcSyncDate FROM sync;
|
||||
|
||||
DROP TABLE sync;
|
||||
|
||||
|
@ -51,7 +51,7 @@ class ConsistencyChecks {
|
||||
childToParents[childNoteId].push(parentNoteId);
|
||||
}
|
||||
|
||||
function checkTreeCycle(noteId, path) {
|
||||
const checkTreeCycle = (noteId, path) => {
|
||||
if (noteId === 'root') {
|
||||
return;
|
||||
}
|
||||
@ -75,7 +75,7 @@ class ConsistencyChecks {
|
||||
checkTreeCycle(parentNoteId, newPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const noteIds = Object.keys(childToParents);
|
||||
|
||||
|
@ -112,7 +112,7 @@ async function updateEntity(entity) {
|
||||
if (entity.isChanged) {
|
||||
const isSynced = entityName !== 'options' || entity.isSynced;
|
||||
|
||||
await syncTableService.addEntitySync(entityName, primaryKey, isSynced);
|
||||
await syncTableService.addEntitySync(entityName, primaryKey, null, isSynced);
|
||||
|
||||
if (!cls.isEntityEventsDisabled()) {
|
||||
const eventPayload = {
|
||||
|
@ -10,13 +10,13 @@ const cls = require('./cls');
|
||||
|
||||
let maxSyncId = 0;
|
||||
|
||||
async function insertEntitySync(entityName, entityId, sourceId, isSynced) {
|
||||
async function insertEntitySync(entityName, entityId, sourceId = null, isSynced = true) {
|
||||
const sync = {
|
||||
entityName: entityName,
|
||||
entityId: entityId,
|
||||
utcSyncDate: dateUtils.utcNowDateTime(),
|
||||
sourceId: sourceId || cls.getSourceId() || sourceIdService.getCurrentSourceId(),
|
||||
isSynced: isSynced
|
||||
isSynced: isSynced ? 1 : 0
|
||||
};
|
||||
|
||||
sync.id = await sql.replace("sync", sync);
|
||||
@ -26,7 +26,7 @@ async function insertEntitySync(entityName, entityId, sourceId, isSynced) {
|
||||
return sync;
|
||||
}
|
||||
|
||||
async function addEntitySync(entityName, entityId, sourceId, isSynced = true) {
|
||||
async function addEntitySync(entityName, entityId, sourceId, isSynced) {
|
||||
const sync = await insertEntitySync(entityName, entityId, sourceId, isSynced);
|
||||
|
||||
cls.addSyncRow(sync);
|
||||
|
Loading…
x
Reference in New Issue
Block a user