summaryrefslogtreecommitdiff
path: root/src/chef/database/init.clj
blob: 803e85ad5bf540dec8ba20060040e36de0f63864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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]]})) ;TODO: create root category
  (jdbc/execute! db (sql/format {:create-table :recipes
                                 :with-columns [[:id :integer :auto-increment :primary-key]
                                                [:category :integer]
                                                [:title :text]
                                                [:description :text]]})))