From 29eb88bac3bbc1db17bb4ed75f9b8bfe16333967 Mon Sep 17 00:00:00 2001 From: azivner Date: Sun, 7 Jan 2018 20:16:31 -0500 Subject: [PATCH] added consistency check --- services/consistency_checks.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/services/consistency_checks.js b/services/consistency_checks.js index c02b3352b..b49a45afe 100644 --- a/services/consistency_checks.js +++ b/services/consistency_checks.js @@ -187,6 +187,17 @@ async function runAllChecks() { notes_image.note_image_id IS NULL`, "Image with no note relation", errorList); + await runCheck(` + SELECT + notes_image.note_image_id + FROM + notes_image + JOIN images USING(image_id) + WHERE + notes_image.is_deleted = 0 + AND images.is_deleted = 1`, + "Note image is not deleted while image is deleted for note_image_id", errorList); + await runSyncRowChecks("notes", "note_id", errorList); await runSyncRowChecks("notes_history", "note_history_id", errorList); await runSyncRowChecks("notes_tree", "note_tree_id", errorList);