From 75e073baefb3b13337d91990762f1eeda66b89c2 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Tue, 6 Aug 2024 20:39:19 +0300 Subject: New database: Add db-update-v3. * Storing of deck specific values now will be done using global variables, now in addition with tags. * Remove deprecated sm2 like nomeclature and use gnosis new variables. --- gnosis.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gnosis.el') diff --git a/gnosis.el b/gnosis.el index 3e0049a..b092be2 100644 --- a/gnosis.el +++ b/gnosis.el @@ -2180,6 +2180,22 @@ Return note ids for notes that match QUERY." `(like main ,(format "%%%s%%" word))) words)))) (gnosis-select 'id 'notes clause t))) +(defun gnosis-db-update-v3 () + "Upgrade database to version 3." + (emacsql-with-transaction gnosis-db + (emacsql gnosis-db [:alter-table decks :drop-column failure-factor]) + (emacsql gnosis-db [:alter-table decks :drop-column ef-increase]) + (emacsql gnosis-db [:alter-table decks :drop-column ef-threshold]) + (emacsql gnosis-db [:alter-table decks :drop-column ef-decrease]) + (emacsql gnosis-db [:alter-table decks :drop-column initial-interval]) + ;; Review changes + (emacsql gnosis-db [:alter-table review :rename ef :to gnosis]) + (emacsql gnosis-db [:alter-table review :rename ff :to amnesia]) + (emacsql gnosis-db [:alter-table review :drop-column interval]) + ;; Add activity log + (gnosis--create-table 'activity-log gnosis-db-schema-activity-log) + ;; Update version + (emacsql gnosis-db (format "PRAGMA user_version = %s" gnosis-db-version)))) (defun gnosis-db-init () "Create essential directories & database." -- cgit v1.2.3