From e1eec6efc7cb1b15a800dd0ad25e0f7df3a6eddc Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 6 Aug 2024 20:41:08 +0300 Subject: db: Add v2 function. * Storing v2 update function for users that have not updated to v2. --- gnosis.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index 610e3a4..1348123 100644 --- a/gnosis.el +++ b/gnosis.el @@ -2180,6 +2180,19 @@ Return note ids for notes that match QUERY." `(like main ,(format "%%%s%%" word))) words)))) (gnosis-select 'id 'notes clause t))) +(defun gnosis-db-update-v2 () + "Update to first gnosis-db version." + (emacsql-with-transaction gnosis-db + (emacsql gnosis-db [:alter-table decks :add failure-factor]) + (emacsql gnosis-db [:alter-table decks :add ef-increase]) + (emacsql gnosis-db [:alter-table decks :add ef-decrease]) + (emacsql gnosis-db [:alter-table decks :add ef-threshold]) + (emacsql gnosis-db [:alter-table decks :add initial-interval]) + (emacsql gnosis-db (format "PRAGMA user_version = 2")) + (gnosis--create-table 'activity-log gnosis-db-schema-activity-log) + ;; Update to most recent gnosis db version. + (gnosis-db-update-v3))) + (defun gnosis-db-update-v3 () "Upgrade database to version 3." (emacsql-with-transaction gnosis-db -- cgit v1.2.3