summaryrefslogtreecommitdiff
path: root/gnosis.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-08-06 20:41:08 +0300
committerThanos Apollo <[email protected]>2024-08-06 20:41:08 +0300
commite1eec6efc7cb1b15a800dd0ad25e0f7df3a6eddc (patch)
tree846387c258fcf061a031ac80c4f244efb15bbfaf /gnosis.el
parent176404ccadce3dcce1e8f8c5b08449f558275865 (diff)
db: Add v2 function.
* Storing v2 update function for users that have not updated to v2.
Diffstat (limited to 'gnosis.el')
-rw-r--r--gnosis.el13
1 files changed, 13 insertions, 0 deletions
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