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
cleanup of old migrations, since upgrading to 0.61 is possible only from 0.60.
zadamf2a510e4c570
diff --git a/db/migrations/0184__NOOP.js b/db/migrations/0184__NOOP.jsdeleted file mode 100644index 9ad8902dbb..0000000000--- a/db/migrations/0184__NOOP.js+++ /dev/null@@ -1 +0,0 @@-module.exports = () => console.log("NOOP, moved to migration 0189");diff --git a/db/migrations/0185__migrate_black_theme_to_dark.sql b/db/migrations/0185__migrate_black_theme_to_dark.sqldeleted file mode 100644index 7285f6eb78..0000000000--- a/db/migrations/0185__migrate_black_theme_to_dark.sql+++ /dev/null@@ -1,4 +0,0 @@--- black theme has been removed, dark is closest replacement-UPDATE options SET value = 'dark' WHERE name = 'theme' AND value = 'black';--UPDATE options SET value = 'light' WHERE name = 'theme' AND value = 'white';diff --git a/db/migrations/0186__drop_branches_options_utcDateCreated.sql b/db/migrations/0186__drop_branches_options_utcDateCreated.sqldeleted file mode 100644index b678f64a45..0000000000--- a/db/migrations/0186__drop_branches_options_utcDateCreated.sql+++ /dev/null@@ -1,2 +0,0 @@-ALTER TABLE branches DROP COLUMN utcDateCreated;-ALTER TABLE options DROP COLUMN utcDateCreated;diff --git a/db/migrations/0187__add_changeId_to_entity_changes.sql b/db/migrations/0187__add_changeId_to_entity_changes.sqldeleted file mode 100644index 1fdadbec77..0000000000--- a/db/migrations/0187__add_changeId_to_entity_changes.sql+++ /dev/null@@ -1,33 +0,0 @@-CREATE TABLE IF NOT EXISTS "mig_entity_changes" (- `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,- `entityName` TEXT NOT NULL,- `entityId` TEXT NOT NULL,- `hash` TEXT NOT NULL,- `isErased` INT NOT NULL,- `changeId` TEXT NOT NULL,- `sourceId` TEXT NOT NULL,- `isSynced` INTEGER NOT NULL,- `utcDateChanged` TEXT NOT NULL-);--INSERT INTO mig_entity_changes (id, entityName, entityId, hash, isErased, changeId, sourceId, isSynced, utcDateChanged)- SELECT id, entityName, entityId, hash, isErased, '', sourceId, isSynced, utcDateChanged FROM entity_changes;---- delete duplicates https://github.com/zadam/trilium/issues/2534-DELETE FROM mig_entity_changes WHERE isErased = 0 AND id IN (- SELECT id FROM mig_entity_changes ec- WHERE (- SELECT COUNT(*) FROM mig_entity_changes- WHERE ec.entityName = mig_entity_changes.entityName- AND ec.entityId = mig_entity_changes.entityId- ) > 1-);--DROP TABLE entity_changes;--ALTER TABLE mig_entity_changes RENAME TO entity_changes;--CREATE UNIQUE INDEX `IDX_entityChanges_entityName_entityId` ON "entity_changes" (- `entityName`,- `entityId`- );diff --git a/db/migrations/0188__set_hidden_branchId.sql b/db/migrations/0188__set_hidden_branchId.sqldeleted file mode 100644index 8ef8116d70..0000000000--- a/db/migrations/0188__set_hidden_branchId.sql+++ /dev/null@@ -1,8 +0,0 @@-UPDATE branches SET branchId = 'hidden' where branchId = (- SELECT branchId FROM branches- WHERE parentNoteId = 'root'- AND noteId = 'hidden'- AND isDeleted = 0- ORDER BY utcDateModified- LIMIT 1-);diff --git a/db/migrations/0189__delete_username_option.sql b/db/migrations/0189__delete_username_option.sqldeleted file mode 100644index 439a201e63..0000000000--- a/db/migrations/0189__delete_username_option.sql+++ /dev/null@@ -1 +0,0 @@-DELETE FROM options WHERE name = 'username';diff --git a/db/migrations/0190__change_to_etapi_tokens.sql b/db/migrations/0190__change_to_etapi_tokens.sqldeleted file mode 100644index a9ea45fe79..0000000000--- a/db/migrations/0190__change_to_etapi_tokens.sql+++ /dev/null@@ -1,15 +0,0 @@-CREATE TABLE IF NOT EXISTS "etapi_tokens"-(- etapiTokenId TEXT PRIMARY KEY NOT NULL,- name TEXT NOT NULL,- tokenHash TEXT NOT NULL,- utcDateCreated TEXT NOT NULL,- utcDateModified TEXT NOT NULL,- isDeleted INT NOT NULL DEFAULT 0);--INSERT INTO etapi_tokens (etapiTokenId, name, tokenHash, utcDateCreated, utcDateModified, isDeleted)-SELECT apiTokenId, 'Trilium Sender', token, utcDateCreated, utcDateCreated, isDeleted FROM api_tokens;--DROP TABLE api_tokens;--UPDATE entity_changes SET entityName = 'etapi_tokens' WHERE entityName = 'api_tokens';diff --git a/db/migrations/0191__hash_tokens.js b/db/migrations/0191__hash_tokens.jsdeleted file mode 100644index d799a72833..0000000000--- a/db/migrations/0191__hash_tokens.js+++ /dev/null@@ -1,10 +0,0 @@-module.exports = () => {- const sql = require('../../src/services/sql');- const crypto = require('crypto');-- for (const {etapiTokenId, token} of sql.getRows("SELECT etapiTokenId, tokenHash AS token FROM etapi_tokens")) {- const tokenHash = crypto.createHash('sha256').update(token).digest('base64');-- sql.execute(`UPDATE etapi_tokens SET tokenHash = ? WHERE etapiTokenId = ?`, [tokenHash, etapiTokenId]);- }-};\ No newline at end of filediff --git a/db/migrations/0192__add_memberId_to_entity_changes.sql b/db/migrations/0192__add_memberId_to_entity_changes.sqldeleted file mode 100644index 89d2904c50..0000000000--- a/db/migrations/0192__add_memberId_to_entity_changes.sql+++ /dev/null@@ -1,20 +0,0 @@-DROP TABLE entity_changes;--- not preserving the data because of https://github.com/zadam/trilium/issues/3447--CREATE TABLE IF NOT EXISTS "entity_changes" (- `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,- `entityName` TEXT NOT NULL,- `entityId` TEXT NOT NULL,- `hash` TEXT NOT NULL,- `isErased` INT NOT NULL,- `changeId` TEXT NOT NULL,- `componentId` TEXT NOT NULL,- `instanceId` TEXT NOT NULL,- `isSynced` INTEGER NOT NULL,- `utcDateChanged` TEXT NOT NULL-);--CREATE UNIQUE INDEX `IDX_entityChanges_entityName_entityId` ON "entity_changes" (- `entityName`,- `entityId`- );diff --git a/db/migrations/0193__add_index_to_changeId.sql b/db/migrations/0193__add_index_to_changeId.sqldeleted file mode 100644index 3bc24efb93..0000000000--- a/db/migrations/0193__add_index_to_changeId.sql+++ /dev/null@@ -1 +0,0 @@-CREATE INDEX `IDX_entity_changes_changeId` ON `entity_changes` (`changeId`);diff --git a/db/migrations/0194__add_excludeFromNoteMap_to_journal.js b/db/migrations/0194__add_excludeFromNoteMap_to_journal.jsdeleted file mode 100644index 1cc602960f..0000000000--- a/db/migrations/0194__add_excludeFromNoteMap_to_journal.js+++ /dev/null@@ -1,15 +0,0 @@-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('excludeFromNoteMap', "", true);- }- }- });-};diff --git a/db/migrations/0195__remove_recent_notes_from_entity_changes.sql b/db/migrations/0195__remove_recent_notes_from_entity_changes.sqldeleted file mode 100644index 834db7fe94..0000000000--- a/db/migrations/0195__remove_recent_notes_from_entity_changes.sql+++ /dev/null@@ -1,2 +0,0 @@--- removing potential remnants of recent notes in entity changes, see https://github.com/zadam/trilium/issues/2842-DELETE FROM entity_changes WHERE entityName = 'recent_notes';diff --git a/db/migrations/0196__rename_bulk_actions.sql b/db/migrations/0196__rename_bulk_actions.sqldeleted file mode 100644index ad4c5febe9..0000000000--- a/db/migrations/0196__rename_bulk_actions.sql+++ /dev/null@@ -1,2 +0,0 @@-UPDATE attributes SET value = replace(value, 'setLabelValue', 'updateLabelValue') WHERE name = 'action' AND type = 'label';-UPDATE attributes SET value = replace(value, 'setRelationTarget', 'updateRelationTarget') WHERE name = 'action' AND type = 'label';diff --git a/db/migrations/0197__NOOP.js b/db/migrations/0197__NOOP.jsdeleted file mode 100644index c7bdf54ac2..0000000000--- a/db/migrations/0197__NOOP.js+++ /dev/null@@ -1 +0,0 @@-module.exports = () => console.log("NOOP, increased because of protected notes IV change");diff --git a/db/migrations/0198__rename_branchIds.sql b/db/migrations/0198__rename_branchIds.sqldeleted file mode 100644index 5b32eb51c8..0000000000--- a/db/migrations/0198__rename_branchIds.sql+++ /dev/null@@ -1,6 +0,0 @@-UPDATE branches SET branchId = '_hidden__search' WHERE parentNoteId = 'hidden' AND noteId = 'search' AND isDeleted = 0;-UPDATE branches SET branchId = 'root__globalNoteMap' WHERE parentNoteId = 'singles' AND noteId = 'globalnotemap' AND isDeleted = 0;-UPDATE branches SET branchId = '_hidden__sqlConsole' WHERE parentNoteId = 'hidden' AND noteId = 'sqlconsole' AND isDeleted = 0;-UPDATE branches SET branchId = 'root__hidden' WHERE parentNoteId = 'root' AND noteId = 'hidden' AND isDeleted = 0;-UPDATE branches SET branchId = '_hidden__bulkAction' WHERE parentNoteId = 'hidden' AND noteId = 'bulkaction' AND isDeleted = 0;-UPDATE branches SET branchId = '_hidden__share' WHERE parentNoteId = 'root' AND noteId = 'share' AND isDeleted = 0;diff --git a/db/migrations/0199__rename_ids.sql b/db/migrations/0199__rename_ids.sqldeleted file mode 100644index ca1ed273e3..0000000000--- a/db/migrations/0199__rename_ids.sql+++ /dev/null@@ -1,53 +0,0 @@-UPDATE notes SET noteId = '_globalNoteMap', title = 'Note Map' WHERE noteId = 'globalnotemap';-UPDATE note_contents SET noteId = '_globalNoteMap' WHERE noteId = 'globalnotemap';-UPDATE note_revisions SET noteId = '_globalNoteMap' WHERE noteId = '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', title = 'Bulk Action' WHERE noteId = 'bulkaction';-UPDATE note_contents SET noteId = '_bulkAction' WHERE noteId = 'bulkaction';-UPDATE note_revisions SET noteId = '_bulkAction' WHERE noteId = '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', title = 'SQL Console History' 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 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', title = 'Hidden Notes' 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', prefix = NULL WHERE noteId = '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', title = 'Search History' 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 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';--UPDATE notes SET noteId = '_share', title = 'Shared Notes' WHERE noteId = 'share';-UPDATE note_contents SET noteId = '_share' WHERE noteId = 'share';-UPDATE note_revisions SET noteId = '_share' WHERE noteId = 'share';-UPDATE branches SET noteId = '_share' WHERE noteId = 'share';-UPDATE branches SET parentNoteId = '_share' WHERE parentNoteId = 'share';-UPDATE attributes SET noteId = '_share' WHERE noteId = 'share';-UPDATE attributes SET value = '_share' WHERE type = 'relation' AND value = 'share';-UPDATE entity_changes SET entityId = '_share' WHERE entityId = 'share';diff --git a/db/migrations/0200__create_hidden_subtree.js b/db/migrations/0200__create_hidden_subtree.jsdeleted file mode 100644index 6d283d7155..0000000000--- a/db/migrations/0200__create_hidden_subtree.js+++ /dev/null@@ -1,12 +0,0 @@-module.exports = () => {- const hiddenSubtreeService = require('../../src/services/hidden_subtree');- const cls = require("../../src/services/cls");- const beccaLoader = require("../../src/becca/becca_loader");-- cls.init(() => {- beccaLoader.load();- // make sure the hidden subtree exists since the subsequent migrations we will move some existing notes into it (share...)- // in previous releases hidden subtree was created lazily- hiddenSubtreeService.checkHiddenSubtree(true);- });-};diff --git a/db/migrations/0201__move_share_under_hidden.sql b/db/migrations/0201__move_share_under_hidden.sqldeleted file mode 100644index 84c71b34a6..0000000000--- a/db/migrations/0201__move_share_under_hidden.sql+++ /dev/null@@ -1,2 +0,0 @@-DELETE FROM branches WHERE noteId = '_share' AND parentNoteId != 'root' AND parentNoteId != '_hidden'; -- delete all other branches of _share if any-UPDATE branches SET parentNoteId = '_hidden' WHERE noteId = '_share';diff --git a/db/migrations/0202__move_global_note_map_under_hidden.sql b/db/migrations/0202__move_global_note_map_under_hidden.sqldeleted file mode 100644index 0b634f69f8..0000000000--- a/db/migrations/0202__move_global_note_map_under_hidden.sql+++ /dev/null@@ -1,2 +0,0 @@-DELETE FROM branches WHERE noteId = '_globalNoteMap' AND parentNoteId != 'singles' AND parentNoteId != '_hidden'; -- make sure there are no clones which would fail at the next line-UPDATE branches SET parentNoteId = '_hidden' WHERE noteId = '_globalNoteMap';diff --git a/db/migrations/0203__delete_singles_special_note.sql b/db/migrations/0203__delete_singles_special_note.sqldeleted file mode 100644index 817d6fcc8c..0000000000--- a/db/migrations/0203__delete_singles_special_note.sql+++ /dev/null@@ -1,6 +0,0 @@-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';diff --git a/db/migrations/0204__migrate_bookmarks_to_clones.js b/db/migrations/0204__migrate_bookmarks_to_clones.jsdeleted file mode 100644index 6b180a4460..0000000000--- a/db/migrations/0204__migrate_bookmarks_to_clones.js+++ /dev/null@@ -1,21 +0,0 @@-module.exports = () => {- const cls = require("../../src/services/cls");- const cloningService = require("../../src/services/cloning");- const beccaLoader = require("../../src/becca/becca_loader");- const becca = require("../../src/becca/becca");-- cls.init(() => {- beccaLoader.load();-- for (const attr of becca.findAttributes('label','bookmarked')) {- cloningService.toggleNoteInParent(true, attr.noteId, '_lbBookmarks');-- attr.markAsDeleted("0204__migrate_bookmarks_to_clones");- }-- // bookmarkFolder used to work in 0.57 without the bookmarked label- for (const attr of becca.findAttributes('label','bookmarkFolder')) {- cloningService.toggleNoteInParent(true, attr.noteId, '_lbBookmarks');- }- });-};diff --git a/db/migrations/0205__rename_note_types.sql b/db/migrations/0205__rename_note_types.sqldeleted file mode 100644index 3a056bceba..0000000000--- a/db/migrations/0205__rename_note_types.sql+++ /dev/null@@ -1,3 +0,0 @@-UPDATE notes SET type = 'relationMap' WHERE type = 'relation-map';-UPDATE notes SET type = 'noteMap' WHERE type = 'note-map';-UPDATE notes SET type = 'webView' WHERE type = 'web-view';diff --git a/db/migrations/0206__delete_search_and_sql_console_history.js b/db/migrations/0206__delete_search_and_sql_console_history.jsdeleted file mode 100644index 089d3f58d8..0000000000--- a/db/migrations/0206__delete_search_and_sql_console_history.js+++ /dev/null@@ -1,33 +0,0 @@-// the history was previously not exposed and the fact they were not cleaned up is rather a side-effect than an intention--module.exports = () => {- const cls = require("../../src/services/cls");- const beccaLoader = require("../../src/becca/becca_loader");- const becca = require("../../src/becca/becca");-- cls.init(() => {- beccaLoader.load();-- // deleting just branches because they might be cloned (and therefore saved) also outside of the hidden subtree-- const searchRoot = becca.getNote('_search');-- for (const searchBranch of searchRoot.getChildBranches()) {- const searchNote = searchBranch.getNote();-- if (searchNote.type === 'search') {- searchBranch.deleteBranch('0206__delete_search_and_sql_console_history');- }- }-- const sqlConsoleRoot = becca.getNote('_sqlConsole');-- for (const sqlConsoleBranch of sqlConsoleRoot.getChildBranches()) {- const sqlConsoleNote = sqlConsoleBranch.getNote();-- if (sqlConsoleNote.type === 'code' && sqlConsoleNote.mime === 'text/x-sqlite;schema=trilium') {- sqlConsoleBranch.deleteBranch('0206__delete_search_and_sql_console_history');- }- }- });-};diff --git a/db/migrations/0207__rename_search_and_sql_console.sql b/db/migrations/0207__rename_search_and_sql_console.sqldeleted file mode 100644index b751faedac..0000000000--- a/db/migrations/0207__rename_search_and_sql_console.sql+++ /dev/null@@ -1,2 +0,0 @@-UPDATE notes SET title = 'SQL Console History' WHERE noteId = '_sqlConsole';-UPDATE notes SET title = 'Search History' WHERE noteId = '_search';\ No newline at end of filediff --git a/db/migrations/0208__remove_archived_from_hidden.js b/db/migrations/0208__remove_archived_from_hidden.jsdeleted file mode 100644index 0261ab173d..0000000000--- a/db/migrations/0208__remove_archived_from_hidden.js+++ /dev/null@@ -1,13 +0,0 @@-module.exports = () => {- const cls = require("../../src/services/cls");- const beccaLoader = require("../../src/becca/becca_loader");- const becca = require("../../src/becca/becca");-- cls.init(() => {- beccaLoader.load();-- for (const label of becca.getNote('_hidden').getLabels('archived')) {- label.markAsDeleted('0208__remove_archived_from_hidden');- }- });-};diff --git a/db/migrations/0209__rename_hoisted_labels.sql b/db/migrations/0209__rename_hoisted_labels.sqldeleted file mode 100644index 0ece2c52b0..0000000000--- a/db/migrations/0209__rename_hoisted_labels.sql+++ /dev/null@@ -1,5 +0,0 @@-UPDATE attributes SET name = 'workspaceInbox' WHERE type = 'label' AND name = 'hoistedInbox';-UPDATE entity_changes SET entityId = 'workspaceInbox' WHERE entityName = 'attributes' AND entityId = 'hoistedInbox';--UPDATE attributes SET name = 'workspaceSearchHome' WHERE type = 'label' AND name = 'hoistedSearchHome';-UPDATE entity_changes SET entityId = 'workspaceSearchHome' WHERE entityName = 'attributes' AND entityId = 'hoistedSearchHome';diff --git a/db/migrations/0210__consistency_checks.js b/db/migrations/0210__consistency_checks.jsdeleted file mode 100644index b29331dbe0..0000000000--- a/db/migrations/0210__consistency_checks.js+++ /dev/null@@ -1,24 +0,0 @@-module.exports = async () => {- const cls = require("../../src/services/cls");- const beccaLoader = require("../../src/becca/becca_loader");- const log = require("../../src/services/log");- const consistencyChecks = require("../../src/services/consistency_checks");- const eraseService = require("../../src/services/erase");-- await cls.init(async () => {- // precaution for the 0211 migration- eraseService.eraseDeletedNotesNow();-- beccaLoader.load();-- try {- // precaution before running 211 which might produce unique constraint problems if the DB was not consistent- consistencyChecks.runOnDemandChecksWithoutExclusiveLock(true);- }- catch (e) {- // consistency checks might start failing in the future if there's some incompatible migration down the road- // we can optimistically assume the DB is consistent and still continue- log.error(`Consistency checks failed in migration 0210: ${e.message} ${e.stack}`);- }- });-};diff --git a/db/migrations/0211__rename_branchIds.sql b/db/migrations/0211__rename_branchIds.sqldeleted file mode 100644index be18ec00ce..0000000000--- a/db/migrations/0211__rename_branchIds.sql+++ /dev/null@@ -1,12 +0,0 @@--- case based on isDeleted is needed, otherwise 2 branches (1 deleted, 1 not) might get the same ID-UPDATE entity_changes SET entityId = COALESCE((- SELECT- CASE isDeleted- WHEN 0 THEN parentNoteId || '_' || noteId- WHEN 1 THEN branchId- END- FROM branches WHERE branchId = entityId-), entityId)-WHERE entityName = 'branches' AND isErased = 0;--UPDATE branches SET branchId = parentNoteId || '_' || noteId WHERE isDeleted = 0;diff --git a/db/migrations/0212__delete_all_attributes_of_named_notes.js b/db/migrations/0212__delete_all_attributes_of_named_notes.jsdeleted file mode 100644index a6f532231c..0000000000--- a/db/migrations/0212__delete_all_attributes_of_named_notes.js+++ /dev/null@@ -1,27 +0,0 @@-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);-- for (const attr of note.getOwnedAttributes().slice()) {- attr.markAsDeleted("0212__delete_all_attributes_of_named_notes");- }- }- }- });-};diff --git a/db/migrations/0213__migrate_scripts.js b/db/migrations/0213__migrate_scripts.jsdeleted file mode 100644index eed005c1c1..0000000000--- a/db/migrations/0213__migrate_scripts.js+++ /dev/null@@ -1,48 +0,0 @@-module.exports = () => {- const beccaLoader = require("../../src/becca/becca_loader");- const becca = require("../../src/becca/becca");- const cls = require("../../src/services/cls");- const log = require("../../src/services/log");-- cls.init(() => {- beccaLoader.load();-- for (const note of Object.values(becca.notes)) {- try {- if (!note.isJavaScript()) {- continue;- }-- if (!note.mime?.endsWith('env=frontend') && !note.mime?.endsWith('env=backend')) {- continue;- }-- const origContent = note.getContent().toString();- const fixedContent = origContent- .replaceAll("runOnServer", "runOnBackend")- .replaceAll("api.refreshTree()", "")- .replaceAll("addTextToActiveTabEditor", "addTextToActiveContextEditor")- .replaceAll("getActiveTabNote", "getActiveContextNote")- .replaceAll("getActiveTabTextEditor", "getActiveContextTextEditor")- .replaceAll("getActiveTabNotePath", "getActiveContextNotePath")- .replaceAll("getDateNote", "getDayNote")- .replaceAll("utils.unescapeHtml", "unescapeHtml")- .replaceAll("sortNotesByTitle", "sortNotes")- .replaceAll("CollapsibleWidget", "RightPanelWidget")- .replaceAll("TabAwareWidget", "NoteContextAwareWidget")- .replaceAll("TabCachingWidget", "NoteContextAwareWidget")- .replaceAll("NoteContextCachingWidget", "NoteContextAwareWidget");-- if (origContent !== fixedContent) {- log.info(`Replacing legacy API calls for note '${note.noteId}'`);-- note.saveNoteRevision();- note.setContent(fixedContent);- }- }- catch (e) {- log.error(`Error during migration to 213 for note '${note.noteId}': ${e.message} ${e.stack}`);- }- }- });-};diff --git a/db/migrations/0214__fix_root_children_ordering.sql b/db/migrations/0214__fix_root_children_ordering.sqldeleted file mode 100644index 056a76336f..0000000000--- a/db/migrations/0214__fix_root_children_ordering.sql+++ /dev/null@@ -1 +0,0 @@-UPDATE branches SET notePosition = notePosition - 999899999 WHERE parentNoteId = 'root' AND notePosition > 999999999;