Skip to content

Build your personal knowledge base with Trilium Notes

import of initial demo document sets sync.isSynced incorrectly to always 0, #1163

zadam3582013a337d
diff --git a/db/migrations/0159__fix_isSynced_in_sync_rows.sql b/db/migrations/0159__fix_isSynced_in_sync_rows.sql
new file mode 100644
index 0000000000..82f22b9ef7
--- /dev/null
+++ b/db/migrations/0159__fix_isSynced_in_sync_rows.sql
@@ -0,0 +1,4 @@
+UPDATE sync SET isSynced = 1 WHERE entityName != 'options' OR (
+ entityName = 'options'
+ AND 1 = (SELECT isSynced FROM options WHERE name = sync.entityId)
+ )
diff --git a/src/services/app_info.js b/src/services/app_info.js
index 0df3b0b747..af90d2b89f 100644
--- a/src/services/app_info.js
+++ b/src/services/app_info.js
@@ -4,7 +4,7 @@ const build = require('./build');
const packageJson = require('../../package');
const {TRILIUM_DATA_DIR} = require('./data_dir');
-const APP_DB_VERSION = 158;
+const APP_DB_VERSION = 159;
const SYNC_VERSION = 14;
const CLIPPER_PROTOCOL_VERSION = "1.0";
@@ -16,4 +16,4 @@ module.exports = {
buildRevision: build.buildRevision,
dataDirectory: TRILIUM_DATA_DIR,
clipperProtocolVersion: CLIPPER_PROTOCOL_VERSION
-};
\ No newline at end of file
+};
diff --git a/src/services/sync_table.js b/src/services/sync_table.js
index 6b063aa210..55434d8331 100644
--- a/src/services/sync_table.js
+++ b/src/services/sync_table.js
@@ -82,7 +82,8 @@ async function fillSyncRows(entityName, entityPrimaryKey, condition = '') {
entityName: entityName,
entityId: entityId,
sourceId: "SYNC_FILL",
- utcSyncDate: dateUtils.utcNowDateTime()
+ utcSyncDate: dateUtils.utcNowDateTime(),
+ isSynced: true
});
}
}
@@ -127,4 +128,4 @@ module.exports = {
fillAllSyncRows,
addEntitySyncsForSector,
getMaxSyncId: () => maxSyncId
-};
\ No newline at end of file
+};