summaryrefslogtreecommitdiff
path: root/src/chef/database/init.clj
blob: 7f23d2781bbb9d93e9b0611b8689e9d82d6bf922 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(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 :primary-key :autoincrement]
                                                [:name :text]
                                                [:question :text]
                                                [:parent :integer]]})) ;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]]})))