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

@ -7,7 +7,9 @@ CREATE TABLE IF NOT EXISTS "etapi_tokens"
utcDateModified TEXT NOT NULL,
isDeleted INT NOT NULL DEFAULT 0);
INSERT INTO etapi_tokens (etapiTokenId, name, tokenHash, utcDateCreated, utcDateModified, isDeleted)
INSERT INTO etapi_tokens (etapiTokenId, name, tokenHash, utcDateCreated, utcDateModified, isDeleted)
SELECT apiTokenId, 'Trilium Sender', token, utcDateCreated, utcDateCreated, isDeleted FROM 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,
tokenHash TEXT NOT NULL,
utcDateCreated TEXT NOT NULL,
utcDateModified TEXT NOT NULL,
isDeleted INT NOT NULL DEFAULT 0);
CREATE TABLE IF NOT EXISTS "branches" (
`branchId` TEXT NOT NULL,

View File

@ -47,8 +47,8 @@ function checkContentHashes(otherHashes) {
const failedChecks = [];
for (const entityName in entityHashes) {
const thisSectorHashes = entityHashes[entityName];
const otherSectorHashes = otherHashes[entityName];
const thisSectorHashes = entityHashes[entityName] || {};
const otherSectorHashes = otherHashes[entityName] || {};
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);
process.exit(0);
throw new Error("AAAA");
return;
if (failedChecks.length > 0) {
// before requeuing sectors make sure the entity changes are correct
const consistencyChecks = require("./consistency_checks");