mini optimizations

This commit is contained in:
zadam
2019-12-01 15:01:09 +01:00
parent 7ef2e7769f
commit 3b690f5456
3 changed files with 10 additions and 10 deletions

View File

@@ -264,7 +264,7 @@ async function findExistencyIssues() {
branches.parentNoteId,
branches.noteId
HAVING
COUNT(*) > 1`,
COUNT(1) > 1`,
async ({noteId, parentNoteId}, autoFix) => {
if (autoFix) {
const branches = await repository.getEntities(
@@ -636,11 +636,11 @@ async function showEntityStat(name, query) {
}
async function runDbDiagnostics() {
await showEntityStat("Notes", `SELECT isDeleted, count(noteId) FROM notes GROUP BY isDeleted`);
await showEntityStat("Note revisions", `SELECT isErased, count(noteRevisionId) FROM note_revisions GROUP BY isErased`);
await showEntityStat("Branches", `SELECT isDeleted, count(branchId) FROM branches GROUP BY isDeleted`);
await showEntityStat("Attributes", `SELECT isDeleted, count(attributeId) FROM attributes GROUP BY isDeleted`);
await showEntityStat("API tokens", `SELECT isDeleted, count(apiTokenId) FROM api_tokens GROUP BY isDeleted`);
await showEntityStat("Notes", `SELECT isDeleted, count(1) FROM notes GROUP BY isDeleted`);
await showEntityStat("Note revisions", `SELECT isErased, count(1) FROM note_revisions GROUP BY isErased`);
await showEntityStat("Branches", `SELECT isDeleted, count(1) FROM branches GROUP BY isDeleted`);
await showEntityStat("Attributes", `SELECT isDeleted, count(1) FROM attributes GROUP BY isDeleted`);
await showEntityStat("API tokens", `SELECT isDeleted, count(1) FROM api_tokens GROUP BY isDeleted`);
}
async function runChecks() {