summaryrefslogtreecommitdiff
path: root/src/chef/database/init.clj
diff options
context:
space:
mode:
authorTim <contact@bytim.eu>2025-05-12 22:10:39 +0200
committerTim <contact@bytim.eu>2025-05-12 22:10:39 +0200
commit58906c635ad0ea2028f99997cb673ef40a2ea2bb (patch)
tree1eb8718b6d43ab19b0b91acae0f47bcbcc223faa /src/chef/database/init.clj
parent06ecbc8c6d52f3e832683e68a52461c5f7c6cb84 (diff)
downloadchef-58906c635ad0ea2028f99997cb673ef40a2ea2bb.tar.xz
chef-58906c635ad0ea2028f99997cb673ef40a2ea2bb.zip
Add sqlite database
Diffstat (limited to 'src/chef/database/init.clj')
-rw-r--r--src/chef/database/init.clj16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/chef/database/init.clj b/src/chef/database/init.clj
new file mode 100644
index 0000000..f791e39
--- /dev/null
+++ b/src/chef/database/init.clj
@@ -0,0 +1,16 @@
+(ns chef.database.init
+ (:require [next.jdbc :as jdbc]
+ [honey.sql :as sql]))
+
+(defn exec! [db]
+ (jdbc/execute! db (sql/format {:create-table :categories
+ :with-columns [[:id :integer :auto-increment :primary-key]
+ [:name :text]
+ [:question :text]
+ [:children :text]
+ [:parent :text]]}))
+ (jdbc/execute! db (sql/format {:create-table :recipes
+ :with-columns [[:id :integer :auto-increment :primary-key]
+ [:category :integer]
+ [:title :text]
+ [:description :text]]})))