added migration to add excludeFromTreeMap for journal subtrees

This commit is contained in:
zadam 2021-09-23 22:08:23 +02:00
parent fabf24a065
commit b041d081db
7 changed files with 71 additions and 17 deletions

View File

@ -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);
}
}
});
};

54
package-lock.json generated
View File

@ -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"
}

View File

@ -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",

View File

@ -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());

View File

@ -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}`);

View File

@ -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";

View File

@ -32,7 +32,14 @@ async function migrate() {
// backup before attempting migration
await 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)/);