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
refactor(migration): remove async import from migration scripts
Elian Doran16ad054d2a34
diff --git a/db/migrations/0216__move_content_into_blobs.ts b/db/migrations/0216__move_content_into_blobs.tsindex e43bd25e34..f37e570f22 100644--- a/db/migrations/0216__move_content_into_blobs.ts+++ b/db/migrations/0216__move_content_into_blobs.ts@@ -1,3 +1,6 @@+import sql from "../../src/services/sql";+import utils from "../../src/services/utils";+interface NoteContentsRow {noteId: string;content: string | Buffer;@@ -11,10 +14,7 @@ interface NoteRevisionContents {utcDateModified: string;}-export default async () => {- const sql = (await import("../../src/services/sql")).default;- const utils = (await import("../../src/services/utils")).default;-+export default () => {const existingBlobIds = new Set();for (const noteId of sql.getColumn<string>(`SELECT noteId FROM note_contents`)) {diff --git a/db/migrations/0220__migrate_images_to_attachments.ts b/db/migrations/0220__migrate_images_to_attachments.tsindex 60cfd337ff..53eac59583 100644--- a/db/migrations/0220__migrate_images_to_attachments.ts+++ b/db/migrations/0220__migrate_images_to_attachments.ts@@ -1,15 +1,15 @@-export default async () => {- const beccaLoader = (await import("../../src/becca/becca_loader")).default;- const becca = (await import("../../src/becca/becca")).default;- const cls = (await import("../../src/services/cls")).default;- const log = (await import("../../src/services/log")).default;- const sql = (await import("../../src/services/sql")).default;+import becca from "../../src/becca/becca";+import becca_loader from "../../src/becca/becca_loader";+import cls from "../../src/services/cls";+import log from "../../src/services/log";+import sql from "../../src/services/sql";+export default () => {cls.init(() => {// emergency disabling of image compression since it appears to make problems in migration to 0.61sql.execute(`UPDATE options SET value = 'false' WHERE name = 'compressImages'`);- beccaLoader.load();+ becca_loader.load();for (const note of Object.values(becca.notes)) {try {