summaryrefslogtreecommitdiff
path: root/src/chef/database/init.clj
blob: ef4bd2f13af839dfbe8bd1e0ec2329afe7cb4abe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(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]]}))
  (jdbc/execute! db (sql/format {:create-table :recipes
                                 :with-columns [[:id :integer :primary-key :autoincrement]
                                                [:category :integer]
                                                [:title :text]
                                                [:unit :integer]
                                                [:ingredients :text]
                                                [:preparation :text]
                                                [:thumbnail :text]]})))