mirror of
https://github.com/zadam/trilium.git
synced 2025-11-04 20:36:13 +01:00
add prefix "_" to "named" IDs
This commit is contained in:
49
db/migrations/0199__rename_ids.sql
Normal file
49
db/migrations/0199__rename_ids.sql
Normal file
@@ -0,0 +1,49 @@
|
||||
UPDATE notes SET noteId = '_globalNoteMap' WHERE noteId = 'globalnotemap';
|
||||
UPDATE note_contents SET noteId = '_globalNoteMap' WHERE noteId = 'globalnotemap';
|
||||
UPDATE note_revisions SET noteId = '_globalNoteMap' WHERE noteId = 'globalnotemap';
|
||||
UPDATE branches SET branchId = '_globalNoteMap' WHERE branchId = 'globalnotemap';
|
||||
UPDATE branches SET noteId = '_globalNoteMap' WHERE noteId = 'globalnotemap';
|
||||
UPDATE branches SET parentNoteId = '_globalNoteMap' WHERE parentNoteId = 'globalnotemap';
|
||||
UPDATE attributes SET noteId = '_globalNoteMap' WHERE noteId = 'globalnotemap';
|
||||
UPDATE attributes SET value = '_globalNoteMap' WHERE type = 'relation' AND value = 'globalnotemap';
|
||||
UPDATE entity_changes SET entityId = '_globalNoteMap' WHERE entityId = 'globalnotemap';
|
||||
|
||||
UPDATE notes SET noteId = '_bulkAction' WHERE noteId = 'bulkaction';
|
||||
UPDATE note_contents SET noteId = '_bulkAction' WHERE noteId = 'bulkaction';
|
||||
UPDATE note_revisions SET noteId = '_bulkAction' WHERE noteId = 'bulkaction';
|
||||
UPDATE branches SET branchId = '_bulkAction' WHERE branchId = 'bulkaction';
|
||||
UPDATE branches SET parentNoteId = '_bulkAction' WHERE parentNoteId = 'bulkaction';
|
||||
UPDATE branches SET noteId = '_bulkAction' WHERE noteId = 'bulkaction';
|
||||
UPDATE attributes SET noteId = '_bulkAction' WHERE noteId = 'bulkaction';
|
||||
UPDATE attributes SET value = '_bulkAction' WHERE type = 'relation' AND value = 'bulkaction';
|
||||
UPDATE entity_changes SET entityId = '_bulkAction' WHERE entityId = 'bulkaction';
|
||||
|
||||
UPDATE notes SET noteId = '_sqlConsole' WHERE noteId = 'sqlconsole';
|
||||
UPDATE note_contents SET noteId = '_sqlConsole' WHERE noteId = 'sqlconsole';
|
||||
UPDATE note_revisions SET noteId = '_sqlConsole' WHERE noteId = 'sqlconsole';
|
||||
UPDATE branches SET noteId = '_sqlConsole' WHERE noteId = 'sqlconsole';
|
||||
UPDATE branches SET branchId = '_sqlConsole' WHERE branchId = 'sqlconsole';
|
||||
UPDATE branches SET parentNoteId = '_sqlConsole' WHERE parentNoteId = 'sqlconsole';
|
||||
UPDATE attributes SET noteId = '_sqlConsole' WHERE noteId = 'sqlconsole';
|
||||
UPDATE attributes SET value = '_sqlConsole' WHERE type = 'relation' AND value = 'sqlconsole';
|
||||
UPDATE entity_changes SET entityId = '_sqlConsole' WHERE entityId = 'sqlconsole';
|
||||
|
||||
UPDATE notes SET noteId = '_hidden' WHERE noteId = 'hidden';
|
||||
UPDATE note_contents SET noteId = '_hidden' WHERE noteId = 'hidden';
|
||||
UPDATE note_revisions SET noteId = '_hidden' WHERE noteId = 'hidden';
|
||||
UPDATE branches SET noteId = '_hidden' WHERE noteId = 'hidden';
|
||||
UPDATE branches SET branchId = '_hidden' WHERE branchId = 'hidden';
|
||||
UPDATE branches SET parentNoteId = '_hidden' WHERE parentNoteId = 'hidden';
|
||||
UPDATE attributes SET noteId = '_hidden' WHERE noteId = 'hidden';
|
||||
UPDATE attributes SET value = '_hidden' WHERE type = 'relation' AND value = 'hidden';
|
||||
UPDATE entity_changes SET entityId = '_hidden' WHERE entityId = 'hidden';
|
||||
|
||||
UPDATE notes SET noteId = '_search' WHERE noteId = 'search';
|
||||
UPDATE note_contents SET noteId = '_search' WHERE noteId = 'search';
|
||||
UPDATE note_revisions SET noteId = '_search' WHERE noteId = 'search';
|
||||
UPDATE branches SET noteId = '_search' WHERE noteId = 'search';
|
||||
UPDATE branches SET branchId = '_search' WHERE branchId = 'search';
|
||||
UPDATE branches SET parentNoteId = '_search' WHERE parentNoteId = 'search';
|
||||
UPDATE attributes SET noteId = '_search' WHERE noteId = 'search';
|
||||
UPDATE attributes SET value = '_search' WHERE type = 'relation' AND value = 'search';
|
||||
UPDATE entity_changes SET entityId = '_search' WHERE entityId = 'search';
|
||||
@@ -1,35 +0,0 @@
|
||||
UPDATE notes SET noteId = 'globalNoteMap' WHERE noteId = 'globalnotemap';
|
||||
UPDATE notes SET noteId = 'bulkAction' WHERE noteId = 'bulkaction';
|
||||
UPDATE notes SET noteId = 'sqlConsole' WHERE noteId = 'sqlconsole';
|
||||
|
||||
UPDATE note_contents SET noteId = 'globalNoteMap' WHERE noteId = 'globalnotemap';
|
||||
UPDATE note_contents SET noteId = 'bulkAction' WHERE noteId = 'bulkaction';
|
||||
UPDATE note_contents SET noteId = 'sqlConsole' WHERE noteId = 'sqlconsole';
|
||||
|
||||
UPDATE note_revisions SET noteId = 'globalNoteMap' WHERE noteId = 'globalnotemap';
|
||||
UPDATE note_revisions SET noteId = 'bulkAction' WHERE noteId = 'bulkaction';
|
||||
UPDATE note_revisions SET noteId = 'sqlConsole' WHERE noteId = 'sqlconsole';
|
||||
|
||||
UPDATE branches SET branchId = 'globalNoteMap' WHERE branchId = 'globalnotemap';
|
||||
UPDATE branches SET branchId = 'bulkAction' WHERE branchId = 'bulkaction';
|
||||
UPDATE branches SET branchId = 'sqlConsole' WHERE branchId = 'sqlconsole';
|
||||
|
||||
UPDATE branches SET noteId = 'globalNoteMap' WHERE noteId = 'globalnotemap';
|
||||
UPDATE branches SET noteId = 'bulkAction' WHERE noteId = 'bulkaction';
|
||||
UPDATE branches SET noteId = 'sqlConsole' WHERE noteId = 'sqlconsole';
|
||||
|
||||
UPDATE branches SET parentNoteId = 'globalNoteMap' WHERE parentNoteId = 'globalnotemap';
|
||||
UPDATE branches SET parentNoteId = 'bulkAction' WHERE parentNoteId = 'bulkaction';
|
||||
UPDATE branches SET parentNoteId = 'sqlConsole' WHERE parentNoteId = 'sqlconsole';
|
||||
|
||||
UPDATE attributes SET noteId = 'globalNoteMap' WHERE noteId = 'globalnotemap';
|
||||
UPDATE attributes SET noteId = 'bulkAction' WHERE noteId = 'bulkaction';
|
||||
UPDATE attributes SET noteId = 'sqlConsole' WHERE noteId = 'sqlconsole';
|
||||
|
||||
UPDATE attributes SET value = 'globalNoteMap' WHERE type = 'relation' AND value = 'globalnotemap';
|
||||
UPDATE attributes SET value = 'bulkAction' WHERE type = 'relation' AND value = 'bulkaction';
|
||||
UPDATE attributes SET value = 'sqlConsole' WHERE type = 'relation' AND value = 'sqlconsole';
|
||||
|
||||
UPDATE entity_changes SET entityId = 'globalNoteMap' WHERE entityId = 'globalnotemap';
|
||||
UPDATE entity_changes SET entityId = 'bulkAction' WHERE entityId = 'bulkaction';
|
||||
UPDATE entity_changes SET entityId = 'sqlConsole' WHERE entityId = 'sqlconsole';
|
||||
@@ -1 +1 @@
|
||||
UPDATE branches SET parentNoteId = 'hidden' WHERE branchId = 'share';
|
||||
UPDATE branches SET parentNoteId = '_hidden' WHERE branchId = '_share';
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
UPDATE branches SET parentNoteId = 'hidden' WHERE noteId = 'globalNoteMap';
|
||||
DELETE FROM branches WHERE noteId = '_globalNoteMap' AND parentNoteId != 'singles'; -- make sure there are no clones which would fail at the next line
|
||||
UPDATE branches SET parentNoteId = '_hidden' WHERE noteId = '_globalNoteMap';
|
||||
|
||||
@@ -10,7 +10,7 @@ module.exports = () => {
|
||||
|
||||
// deleting just branches because they might be cloned (and therefore saved) also outside of the hidden subtree
|
||||
|
||||
const searchRoot = becca.getNote('search');
|
||||
const searchRoot = becca.getNote('_search');
|
||||
|
||||
for (const searchBranch of searchRoot.getChildBranches()) {
|
||||
const searchNote = searchBranch.getNote();
|
||||
@@ -20,7 +20,7 @@ module.exports = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const sqlConsoleRoot = becca.getNote('sqlConsole');
|
||||
const sqlConsoleRoot = becca.getNote('_sqlConsole');
|
||||
|
||||
for (const sqlConsoleBranch of sqlConsoleRoot.getChildBranches()) {
|
||||
const sqlConsoleNote = sqlConsoleBranch.getNote();
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
UPDATE notes SET title = 'SQL Console History' WHERE noteId = 'sqlConsole';
|
||||
UPDATE notes SET title = 'Search History' WHERE noteId = 'search';
|
||||
UPDATE notes SET title = 'SQL Console History' WHERE noteId = '_sqlConsole';
|
||||
UPDATE notes SET title = 'Search History' WHERE noteId = '_search';
|
||||
@@ -6,7 +6,7 @@ module.exports = () => {
|
||||
cls.init(() => {
|
||||
beccaLoader.load();
|
||||
|
||||
for (const label of becca.getNote('hidden').getLabels('archived')) {
|
||||
for (const label of becca.getNote('_hidden').getLabels('archived')) {
|
||||
label.markAsDeleted('0208__remove_archived_from_hidden');
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user