-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.clj
42 lines (31 loc) · 1.13 KB
/
user.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
(ns user
(:require [cat.config :refer [env]]
[clojure.spec.alpha :as s]
[expound.alpha :as expound]
[mount.core :as mount]
[cat.figwheel :refer [start-fw stop-fw cljs]]
[cat.core :refer [start-app]]
[cat.db.core]
[conman.core :as conman]
[luminus-migrations.core :as migrations]))
(alter-var-root #'s/*explain-out* (constantly expound/printer))
(defn start []
(mount/start-without #'cat.core/repl-server))
(defn stop []
(mount/stop-except #'cat.core/repl-server))
(defn restart []
(stop)
(start))
(defn restart-db []
(mount/stop #'cat.db.core/*db*)
(mount/start #'cat.db.core/*db*)
(binding [*ns* 'cat.db.core]
(conman/bind-connection cat.db.core/*db* "sql/queries.sql")))
(defn reset-db []
(migrations/migrate ["reset"] (select-keys env [:database-url])))
(defn migrate []
(migrations/migrate ["migrate"] (select-keys env [:database-url])))
(defn rollback []
(migrations/migrate ["rollback"] (select-keys env [:database-url])))
(defn create-migration [name]
(migrations/create name (select-keys env [:database-url])))