mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
(fix): fix rename file corrupting database (#1308)
The rename file advice is passed relative file names: e.g. "foo.org" -> "bar.org". This was not accounted for, and paths in the Org-roam database are supposed to be absolute paths. This caused the storing of relative paths in the Org-roam database, which were then never purged. Fixes #1304
This commit is contained in:
@ -255,15 +255,14 @@ This function is called on `org-roam-db-file-update-timer'."
|
||||
(dolist (table (mapcar #'car org-roam-db--table-schemata))
|
||||
(org-roam-db-query `[:delete :from ,table]))))
|
||||
|
||||
(defun org-roam-db--clear-file (&optional filepath)
|
||||
"Remove any related links to the file at FILEPATH.
|
||||
(defun org-roam-db--clear-file (&optional file)
|
||||
"Remove any related links to the FILE.
|
||||
This is equivalent to removing the node from the graph."
|
||||
(let ((file (expand-file-name (or filepath
|
||||
(buffer-file-name (buffer-base-buffer))))))
|
||||
(dolist (table (mapcar #'car org-roam-db--table-schemata))
|
||||
(org-roam-db-query `[:delete :from ,table
|
||||
:where (= ,(if (eq table 'links) 'source 'file) $s1)]
|
||||
file))))
|
||||
(setq file (or file (buffer-file-name (buffer-base-buffer))))
|
||||
(dolist (table (mapcar #'car org-roam-db--table-schemata))
|
||||
(org-roam-db-query `[:delete :from ,table
|
||||
:where (= ,(if (eq table 'links) 'source 'file) $s1)]
|
||||
file)))
|
||||
|
||||
;;;;; Inserting
|
||||
(defun org-roam-db--insert-meta (&optional update-p)
|
||||
|
Reference in New Issue
Block a user