From 9f472b353a2cd5fa9439576bc167524117d18a98 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 23 Dec 2020 21:22:41 +0100 Subject: [PATCH] simplified table stats --- src/services/consistency_checks.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/services/consistency_checks.js b/src/services/consistency_checks.js index 99ee0276c..15c7d0087 100644 --- a/src/services/consistency_checks.js +++ b/src/services/consistency_checks.js @@ -566,17 +566,15 @@ class ConsistencyChecks { } runDbDiagnostics() { - function showEntityStat(tableName) { + function getTableCount(tableName) { const count = sql.getValue(`SELECT COUNT(1) FROM ${tableName}`); - log.info(`${tableName}: ${count}`); + return `${tableName}: ${count}`; } - showEntityStat("notes"); - showEntityStat("note_revisions"); - showEntityStat("branches"); - showEntityStat("attributes"); - showEntityStat("api_tokens"); + const tables = [ "notes", "note_revisions", "branches", "attributes", "api_tokens" ]; + + log.info("Table counts: " + tables.map(tableName => getTableCount(tableName)).join(", ")); } async runChecks() {