mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
cleanup of hidden notes
This commit is contained in:
parent
3122d0cc6b
commit
c92b451033
@ -1 +0,0 @@
|
|||||||
module.exports = () => console.log("NOOP, increased because of new note type");
|
|
10
db/migrations/0198__create_hidden_subtree.js
Normal file
10
db/migrations/0198__create_hidden_subtree.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
module.exports = () => {
|
||||||
|
const specialNotesService = require('../../src/services/special_notes');
|
||||||
|
const cls = require("../../src/services/cls");
|
||||||
|
const beccaLoader = require("../../src/becca/becca_loader");
|
||||||
|
|
||||||
|
cls.init(() => {
|
||||||
|
beccaLoader.load();
|
||||||
|
specialNotesService.getHiddenRoot();
|
||||||
|
});
|
||||||
|
};
|
@ -0,0 +1 @@
|
|||||||
|
UPDATE branches SET parentNoteId = 'hidden' WHERE noteId = 'globalnotemap';
|
3
db/migrations/0201__set_branch_id_in_hidden_subtree.sql
Normal file
3
db/migrations/0201__set_branch_id_in_hidden_subtree.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
UPDATE branches SET branchId = 'search' WHERE parentNoteId = 'hidden' AND noteId = 'search';
|
||||||
|
UPDATE branches SET branchId = 'globalnotemap' WHERE parentNoteId = 'hidden' AND noteId = 'globalnotemap';
|
||||||
|
UPDATE branches SET branchId = 'sqlconsole' WHERE parentNoteId = 'hidden' AND noteId = 'sqlconsole';
|
6
db/migrations/0202__delete_singles_special_note.sql
Normal file
6
db/migrations/0202__delete_singles_special_note.sql
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
DELETE FROM branches WHERE noteId = 'singles';
|
||||||
|
DELETE FROM notes WHERE noteId = 'singles';
|
||||||
|
DELETE FROM note_contents WHERE noteId = 'singles';
|
||||||
|
DELETE FROM note_revisions WHERE noteId = 'singles';
|
||||||
|
DELETE FROM attributes WHERE noteId = 'singles';
|
||||||
|
DELETE FROM entity_changes WHERE entityId = 'singles';
|
@ -4,7 +4,7 @@ const build = require('./build');
|
|||||||
const packageJson = require('../../package');
|
const packageJson = require('../../package');
|
||||||
const {TRILIUM_DATA_DIR} = require('./data_dir');
|
const {TRILIUM_DATA_DIR} = require('./data_dir');
|
||||||
|
|
||||||
const APP_DB_VERSION = 199;
|
const APP_DB_VERSION = 202;
|
||||||
const SYNC_VERSION = 27;
|
const SYNC_VERSION = 27;
|
||||||
const CLIPPER_PROTOCOL_VERSION = "1.0";
|
const CLIPPER_PROTOCOL_VERSION = "1.0";
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ class ConsistencyChecks {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.findAndFixIssues(`
|
this.findAndFixIssues(`
|
||||||
SELECT branchId, branches.noteId AS parentNoteId
|
SELECT branchId, branches.parentNoteId AS parentNoteId
|
||||||
FROM branches
|
FROM branches
|
||||||
LEFT JOIN notes ON notes.noteId = branches.parentNoteId
|
LEFT JOIN notes ON notes.noteId = branches.parentNoteId
|
||||||
WHERE branches.isDeleted = 0
|
WHERE branches.isDeleted = 0
|
||||||
|
@ -56,6 +56,7 @@ function getSearchRoot() {
|
|||||||
|
|
||||||
if (!searchRoot) {
|
if (!searchRoot) {
|
||||||
searchRoot = noteService.createNewNote({
|
searchRoot = noteService.createNewNote({
|
||||||
|
branchId: 'search',
|
||||||
noteId: 'search',
|
noteId: 'search',
|
||||||
title: 'search',
|
title: 'search',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
@ -67,32 +68,17 @@ function getSearchRoot() {
|
|||||||
return searchRoot;
|
return searchRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSinglesNoteRoot() {
|
|
||||||
let singlesNoteRoot = becca.getNote('singles');
|
|
||||||
|
|
||||||
if (!singlesNoteRoot) {
|
|
||||||
singlesNoteRoot = noteService.createNewNote({
|
|
||||||
noteId: 'singles',
|
|
||||||
title: 'singles',
|
|
||||||
type: 'text',
|
|
||||||
content: '',
|
|
||||||
parentNoteId: getHiddenRoot().noteId
|
|
||||||
}).note;
|
|
||||||
}
|
|
||||||
|
|
||||||
return singlesNoteRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getGlobalNoteMap() {
|
function getGlobalNoteMap() {
|
||||||
let globalNoteMap = becca.getNote('globalnotemap');
|
let globalNoteMap = becca.getNote('globalnotemap');
|
||||||
|
|
||||||
if (!globalNoteMap) {
|
if (!globalNoteMap) {
|
||||||
globalNoteMap = noteService.createNewNote({
|
globalNoteMap = noteService.createNewNote({
|
||||||
|
branchId: 'globalnotemap',
|
||||||
noteId: 'globalnotemap',
|
noteId: 'globalnotemap',
|
||||||
title: 'Global Note Map',
|
title: 'Global Note Map',
|
||||||
type: 'note-map',
|
type: 'note-map',
|
||||||
content: '',
|
content: '',
|
||||||
parentNoteId: getSinglesNoteRoot().noteId
|
parentNoteId: getHiddenRoot().noteId
|
||||||
}).note;
|
}).note;
|
||||||
|
|
||||||
globalNoteMap.addLabel('mapRootNoteId', 'hoisted');
|
globalNoteMap.addLabel('mapRootNoteId', 'hoisted');
|
||||||
@ -106,6 +92,7 @@ function getSqlConsoleRoot() {
|
|||||||
|
|
||||||
if (!sqlConsoleRoot) {
|
if (!sqlConsoleRoot) {
|
||||||
sqlConsoleRoot = noteService.createNewNote({
|
sqlConsoleRoot = noteService.createNewNote({
|
||||||
|
branchId: 'sqlconsole',
|
||||||
noteId: 'sqlconsole',
|
noteId: 'sqlconsole',
|
||||||
title: 'SQL Console',
|
title: 'SQL Console',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
@ -332,7 +319,6 @@ const shortcuts = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
function createMissingSpecialNotes() {
|
function createMissingSpecialNotes() {
|
||||||
getSinglesNoteRoot();
|
|
||||||
getSqlConsoleRoot();
|
getSqlConsoleRoot();
|
||||||
getGlobalNoteMap();
|
getGlobalNoteMap();
|
||||||
getBulkActionNote();
|
getBulkActionNote();
|
||||||
@ -450,6 +436,7 @@ module.exports = {
|
|||||||
saveSearchNote,
|
saveSearchNote,
|
||||||
createMissingSpecialNotes,
|
createMissingSpecialNotes,
|
||||||
getShareRoot,
|
getShareRoot,
|
||||||
|
getHiddenRoot,
|
||||||
getBulkActionNote,
|
getBulkActionNote,
|
||||||
createShortcut
|
createShortcut
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user