Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
added migration to add excludeFromTreeMap for journal subtrees
zadamb041d081dbc6
diff --git a/db/migrations/0184__add_excludeFromTreeMap_to_journal.js b/db/migrations/0184__add_excludeFromTreeMap_to_journal.jsnew file mode 100644index 0000000000..71cd5b799a--- /dev/null+++ b/db/migrations/0184__add_excludeFromTreeMap_to_journal.js@@ -0,0 +1,15 @@+const becca = require('../../src/becca/becca');+const beccaLoader = require('../../src/becca/becca_loader');+const cls = require('../../src/services/cls');++module.exports = () => {+ cls.init(() => {+ beccaLoader.load();++ for (const note of Object.values(becca.notes)) {+ if (note.hasLabel('calendarRoot')) {+ note.addLabel('excludeFromTreeMap', "", true);+ }+ }+ });+};diff --git a/package-lock.json b/package-lock.jsonindex 6906c9f532..5e575e66ab 100644--- a/package-lock.json+++ b/package-lock.json@@ -584,9 +584,9 @@}},"@tootallnate/once": {- "version": "1.0.0",- "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.0.0.tgz",- "integrity": "sha512-KYyTT/T6ALPkIRd2Ge080X/BsXvy9O0hcWTtMWkPvwAwF99+vn6Dv4GzrFT/Nn1LePr+FFDbRXXlqmsy9lw2zA=="+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",+ "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A=="},"@types/cacheable-request": {"version": "6.0.2",@@ -4597,11 +4597,11 @@}},"http-proxy-agent": {- "version": "4.0.1",- "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz",- "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==",+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz",+ "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==","requires": {- "@tootallnate/once": "1",+ "@tootallnate/once": "2","agent-base": "6","debug": "4"}@@ -5152,6 +5152,11 @@"xml-name-validator": "^3.0.0"},"dependencies": {+ "@tootallnate/once": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",+ "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw=="+ },"form-data": {"version": "4.0.0","resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",@@ -5162,6 +5167,16 @@"mime-types": "^2.1.12"}},+ "http-proxy-agent": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz",+ "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==",+ "requires": {+ "@tootallnate/once": "1",+ "agent-base": "6",+ "debug": "4"+ }+ },"parse5": {"version": "6.0.1","resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",@@ -5552,6 +5567,25 @@"promise-retry": "^2.0.1","socks-proxy-agent": "^5.0.0","ssri": "^8.0.0"+ },+ "dependencies": {+ "@tootallnate/once": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",+ "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==",+ "dev": true+ },+ "http-proxy-agent": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz",+ "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==",+ "dev": true,+ "requires": {+ "@tootallnate/once": "1",+ "agent-base": "6",+ "debug": "4"+ }+ }}},"markdown-it": {@@ -5813,9 +5847,9 @@"dev": true},"node-abi": {- "version": "3.0.0",- "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.0.0.tgz",- "integrity": "sha512-bAfE5Pp+qqHiz4GkpH64HqHUgK2DippKB3QuYbsOp8QoR8c7S646jJMfsOj+WHZO5dPssO3j+54LwG3w3HeYWg==",+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.1.0.tgz",+ "integrity": "sha512-kVF+eIDzPPwPcJdoVhWboJvdCe+YF1+rkd7+LeYmA95179T0sVB5kKG8VADM/3sBnGWeAUBR8FzH+whlksJTrQ==","requires": {"semver": "^7.3.5"}diff --git a/package.json b/package.jsonindex 8db25fd4d5..85f5d87c34 100644--- a/package.json+++ b/package.json@@ -48,7 +48,7 @@"helmet": "4.6.0","html": "1.0.0","html2plaintext": "2.1.2",- "http-proxy-agent": "4.0.1",+ "http-proxy-agent": "5.0.0","https-proxy-agent": "5.0.0","image-type": "4.1.0","ini": "2.0.0",@@ -59,7 +59,7 @@"jsdom": "17.0.0","mime-types": "2.1.32","multer": "1.4.3",- "node-abi": "3.0.0",+ "node-abi": "3.1.0","open": "8.2.1","portscanner": "2.2.0","rand-token": "1.0.1",diff --git a/src/becca/entities/note.js b/src/becca/entities/note.jsindex 083eac7f98..59e7fce167 100644--- a/src/becca/entities/note.js+++ b/src/becca/entities/note.js@@ -233,8 +233,6 @@ class Note extends AbstractEntity {}}- console.log("POJO update", pojo);-sql.upsert("note_contents", "noteId", pojo);const hash = utils.hash(this.noteId + "|" + pojo.content.toString());diff --git a/src/public/app/services/froca.js b/src/public/app/services/froca.jsindex 6870ffc82c..87476432b6 100644--- a/src/public/app/services/froca.js+++ b/src/public/app/services/froca.js@@ -174,7 +174,7 @@ class Froca {return;}- const searchResultNoteIds = await server.get('special-notes/search-note/' + note.noteId);+ const searchResultNoteIds = await server.get('search-note/' + note.noteId);if (!Array.isArray(searchResultNoteIds)) {throw new Error(`Search note ${note.noteId} failed: ${searchResultNoteIds}`);diff --git a/src/services/app_info.js b/src/services/app_info.jsindex dbd787e941..bc41e3e4e6 100644--- a/src/services/app_info.js+++ b/src/services/app_info.js@@ -4,7 +4,7 @@ const build = require('./build');const packageJson = require('../../package');const {TRILIUM_DATA_DIR} = require('./data_dir');-const APP_DB_VERSION = 183;+const APP_DB_VERSION = 184;const SYNC_VERSION = 21;const CLIPPER_PROTOCOL_VERSION = "1.0";diff --git a/src/services/migration.js b/src/services/migration.jsindex 934052f251..30dfcb7c0a 100644--- a/src/services/migration.js+++ b/src/services/migration.js@@ -32,7 +32,14 @@ async function migrate() {// backup before attempting migrationawait backupService.backupNow("before-migration");- const currentDbVersion = parseInt(optionService.getOption('dbVersion'));+ const currentDbVersion = getDbVersion();++ if (currentDbVersion < 183) {+ log.error("Direct migration from your current version is not supported. Please upgrade to the latest v0.47.X first and only then to this version.");++ utils.crash();+ return;+ }fs.readdirSync(resourceDir.MIGRATIONS_DIR).forEach(file => {const match = file.match(/([0-9]{4})__([a-zA-Z0-9_ ]+)\.(sql|js)/);