Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (32 sloc) 1020 Bytes
(ns {{name}}.models.schema
(:require [ :as sql]
[ :as io]))
(def db-store "site.db")
(def db-spec {:classname "org.h2.Driver"
:subprotocol "h2"
:subname (str (io/resource-path) db-store)
:user "sa"
:password ""
:naming {:keys clojure.string/lower-case
:fields clojure.string/upper-case}})
(defn initialized?
"checks to see if the database schema is present"
(.exists (new (str (io/resource-path) db-store ".h2.db"))))
(defn create-users-table
(sql/with-connection db-spec
[:id "varchar(20) PRIMARY KEY"]
[:first_name "varchar(30)"]
[:last_name "varchar(30)"]
[:email "varchar(30)"]
[:admin :boolean]
[:last_login :time]
[:is_active :boolean]
[:pass "varchar(100)"])))
(defn create-tables
"creates the database tables used by the application"
Jump to Line
Something went wrong with that request. Please try again.