From 64d8c7a657b84a77c19663bf30a663f2e342960b Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 17 Mar 2023 22:14:50 +0100 Subject: [PATCH] add a check for the hidden note existence, #3728 --- db/migrations/0212__delete_all_attributes_of_named_notes.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/db/migrations/0212__delete_all_attributes_of_named_notes.js b/db/migrations/0212__delete_all_attributes_of_named_notes.js index 47ddb9114..d90f25e44 100644 --- a/db/migrations/0212__delete_all_attributes_of_named_notes.js +++ b/db/migrations/0212__delete_all_attributes_of_named_notes.js @@ -2,12 +2,18 @@ module.exports = () => { const cls = require("../../src/services/cls"); const beccaLoader = require("../../src/becca/becca_loader"); const becca = require("../../src/becca/becca"); + const log = require("../../src/services/log"); cls.init(() => { beccaLoader.load(); const hidden = becca.getNote("_hidden"); + if (!hidden) { + log.info("MIGRATION 212: no _hidden note, skipping."); + return; + } + for (const noteId of hidden.getSubtreeNoteIds({includeHidden: true})) { if (noteId.startsWith("_")) { // is "named" note const note = becca.getNote(noteId);