Skip to content

Build your personal knowledge base with Trilium Notes

add indexes sooner in the migration process to speed it up #4535

zadam1e30c0702e58
diff --git a/db/migrations/0215__content_structure.sql b/db/migrations/0215__content_structure.sql
index 9f599cec3c..f8c6a461fb 100644
--- a/db/migrations/0215__content_structure.sql
+++ b/db/migrations/0215__content_structure.sql
@@ -8,3 +8,6 @@ CREATE TABLE IF NOT EXISTS "blobs" (
ALTER TABLE notes ADD blobId TEXT DEFAULT NULL;
ALTER TABLE note_revisions ADD blobId TEXT DEFAULT NULL;
+
+CREATE INDEX IF NOT EXISTS IDX_notes_blobId on notes (blobId);
+CREATE INDEX IF NOT EXISTS IDX_revisions_blobId on revisions (blobId);
diff --git a/db/migrations/0219__attachments.sql b/db/migrations/0219__attachments.sql
index 5e7c93e96f..246360bfe3 100644
--- a/db/migrations/0219__attachments.sql
+++ b/db/migrations/0219__attachments.sql
@@ -19,3 +19,5 @@ CREATE INDEX IDX_attachments_ownerId_role
CREATE INDEX IDX_attachments_utcDateScheduledForErasureSince
on attachments (utcDateScheduledForErasureSince);
+
+CREATE INDEX IF NOT EXISTS IDX_attachments_blobId on attachments (blobId);