fix init of synced options in new database

This commit is contained in:
azivner
2018-08-17 18:11:03 +02:00
parent a42bbba0e5
commit 7f9a8a55ca
5 changed files with 24 additions and 14 deletions

View File

@@ -68,9 +68,18 @@ async function runSyncRowChecks(table, key, errorList) {
${table}
LEFT JOIN sync ON sync.entityName = '${table}' AND entityId = ${key}
WHERE
sync.id IS NULL`,
sync.id IS NULL AND ` + (table === 'options' ? 'isSynced = 1' : '1'),
`Missing sync records for ${key} in table ${table}`, errorList);
console.log(`
SELECT
${key}
FROM
${table}
LEFT JOIN sync ON sync.entityName = '${table}' AND entityId = ${key}
WHERE
sync.id IS NULL AND ` + (table === 'options' ? 'isSynced = 1' : '1'));
await runCheck(`
SELECT
entityId
@@ -224,6 +233,7 @@ async function runAllChecks() {
await runSyncRowChecks("note_images", "noteImageId", errorList);
await runSyncRowChecks("attributes", "attributeId", errorList);
await runSyncRowChecks("api_tokens", "apiTokenId", errorList);
await runSyncRowChecks("options", "name", errorList);
if (errorList.length === 0) {
// we run this only if basic checks passed since this assumes basic data consistency