branch: externals/org-gnosis commit f949378ce7325fe41da23c3b028a531f7a455413 Author: Thanos Apollo <pub...@thanosapollo.org> Commit: Thanos Apollo <pub...@thanosapollo.org>
db-delete-tables: do not hardcode table names. * Getting table names from the table-schemata is cleaner & avoids the need to change the table names for future db versions. --- org-gnosis.el | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/org-gnosis.el b/org-gnosis.el index e15a2f9ea2..d30e1a8f94 100644 --- a/org-gnosis.el +++ b/org-gnosis.el @@ -688,11 +688,9 @@ ENTRY: Journal entry linked under the heading." "Drop all tables." (ignore-errors (emacsql-with-transaction org-gnosis-db - (org-gnosis--drop-table 'nodes) - (org-gnosis--drop-table 'tags) - (org-gnosis--drop-table 'journal) - (org-gnosis--drop-table 'links) - (org-gnosis--drop-table 'node-tag)))) + ;; Maybe use sql for version upgrades that change schemata? + (dolist (table (mapcar #'car org-gnosis-db--table-schemata)) + (org-gnosis--drop-table table))))) (defun org-gnosis-db-sync--journal () "Sync journal entries in databse."