branch: externals/org-gnosis
commit 16d3ce8356dad16cab565c7a54d9fa73ed4a8544
Author: Thanos Apollo <[email protected]>
Commit: Thanos Apollo <[email protected]>

    [fix] db-sync: Create indexes during force rebuild.
---
 org-gnosis.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/org-gnosis.el b/org-gnosis.el
index 3620a0c5c7..be0ff24195 100644
--- a/org-gnosis.el
+++ b/org-gnosis.el
@@ -982,10 +982,12 @@ When FORCE (prefix arg), rebuild database from scratch."
     (message "Syncing org-gnosis database...")
     (emacsql-with-transaction (org-gnosis-db-get)
       (when force
-        ;; Full rebuild: drop and recreate tables
+        ;; Full rebuild: drop and recreate tables with indexes
         (org-gnosis-db-delete-tables)
         (pcase-dolist (`(,table ,schema) org-gnosis-db--table-schemata)
-          (emacsql (org-gnosis-db-get) [:create-table $i1 $S2] table schema)))
+          (emacsql (org-gnosis-db-get) [:create-table $i1 $S2] table schema))
+        (emacsql (org-gnosis-db-get) [:create-index :if-not-exists 
idx-nodes-file :on nodes [file]])
+        (emacsql (org-gnosis-db-get) [:create-index :if-not-exists 
idx-journal-file :on journal [file]]))
       ;; Sync all files with progress reporting
       (org-gnosis-db-update-files force)
       ;; Set current version

Reply via email to