From 0fd5102a26e822beda23fd8605c4bd4ad07facca Mon Sep 17 00:00:00 2001 From: azivner Date: Tue, 13 Mar 2018 19:18:52 -0400 Subject: [PATCH] added consistency check for search note not containing children --- src/services/consistency_checks.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/services/consistency_checks.js b/src/services/consistency_checks.js index 1db06755a..cca970431 100644 --- a/src/services/consistency_checks.js +++ b/src/services/consistency_checks.js @@ -217,6 +217,16 @@ async function runAllChecks() { type != 'text' AND type != 'code' AND type != 'render' AND type != 'file' AND type != 'search'`, "Note has invalid type", errorList); + await runCheck(` + SELECT + parentNoteId + FROM + note_tree + JOIN notes ON notes.noteId = note_tree.parentNoteId + WHERE + type == 'search'`, + "Search note has children", errorList); + await runSyncRowChecks("notes", "noteId", errorList); await runSyncRowChecks("note_revisions", "noteRevisionId", errorList); await runSyncRowChecks("note_tree", "noteTreeId", errorList);