Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 4e3e80bf6d
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (32 sloc) 1.02 kB
(ns {{name}}.models.schema
(:require [clojure.java.jdbc :as sql]
[noir.io :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 java.io.File (str (io/resource-path) db-store ".h2.db"))))
(defn create-users-table
[]
(sql/with-connection db-spec
(sql/create-table
:users
[: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"
[]
(create-users-table))
Jump to Line
Something went wrong with that request. Please try again.