sync fixes

This commit is contained in:
zadam 2022-01-10 21:24:07 +01:00
parent 91e78998d1
commit 42e85aefdc
4 changed files with 6 additions and 8 deletions

View File

@ -11,3 +11,5 @@ INSERT INTO etapi_tokens (etapiTokenId, name, tokenHash, utcDateCreated, utcDate
SELECT apiTokenId, 'Trilium Sender', token, utcDateCreated, utcDateCreated, isDeleted FROM api_tokens; SELECT apiTokenId, 'Trilium Sender', token, utcDateCreated, utcDateCreated, isDeleted FROM api_tokens;
DROP TABLE api_tokens; DROP TABLE api_tokens;
UPDATE entity_changes SET entityName = 'etapi_tokens' WHERE entityName = 'api_tokens';

View File

@ -16,6 +16,7 @@ CREATE TABLE IF NOT EXISTS "etapi_tokens"
name TEXT NOT NULL, name TEXT NOT NULL,
tokenHash TEXT NOT NULL, tokenHash TEXT NOT NULL,
utcDateCreated TEXT NOT NULL, utcDateCreated TEXT NOT NULL,
utcDateModified TEXT NOT NULL,
isDeleted INT NOT NULL DEFAULT 0); isDeleted INT NOT NULL DEFAULT 0);
CREATE TABLE IF NOT EXISTS "branches" ( CREATE TABLE IF NOT EXISTS "branches" (
`branchId` TEXT NOT NULL, `branchId` TEXT NOT NULL,

View File

@ -47,8 +47,8 @@ function checkContentHashes(otherHashes) {
const failedChecks = []; const failedChecks = [];
for (const entityName in entityHashes) { for (const entityName in entityHashes) {
const thisSectorHashes = entityHashes[entityName]; const thisSectorHashes = entityHashes[entityName] || {};
const otherSectorHashes = otherHashes[entityName]; const otherSectorHashes = otherHashes[entityName] || {};
const sectors = new Set(Object.keys(thisSectorHashes).concat(Object.keys(otherSectorHashes))); const sectors = new Set(Object.keys(thisSectorHashes).concat(Object.keys(otherSectorHashes)));

View File

@ -250,11 +250,6 @@ async function checkContentHash(syncContext) {
const failedChecks = contentHashService.checkContentHashes(resp.entityHashes); const failedChecks = contentHashService.checkContentHashes(resp.entityHashes);
process.exit(0);
throw new Error("AAAA");
return;
if (failedChecks.length > 0) { if (failedChecks.length > 0) {
// before requeuing sectors make sure the entity changes are correct // before requeuing sectors make sure the entity changes are correct
const consistencyChecks = require("./consistency_checks"); const consistencyChecks = require("./consistency_checks");