Compare commits

..

No commits in common. '6f18bfe7f8e58711d55a47c6aee8145f16b8cd07' and 'fd9688e0a55e7c0f31e1f5f23540ed829fd13c88' have entirely different histories.

@ -11,7 +11,7 @@
;; static site ;; static site
[compojure "1.6.1"] [compojure "1.6.1"]
[ring/ring-defaults "0.3.2"] [ring/ring-defaults "0.3.2"]
[ring/ring-jetty-adapter "1.8.0" [ring/ring-jetty-adapter "1.7.1"
:exclusions [ring/ring-core :exclusions [ring/ring-core
ring/ring-codec ring/ring-codec
commons-io commons-io
@ -23,7 +23,7 @@
;; compojure uses old transitive dependencies of ring ;; compojure uses old transitive dependencies of ring
;; specifiy them here explicitly so newer versions ;; specifiy them here explicitly so newer versions
;; will be used ;; will be used
[ring/ring-core "1.8.0"] [ring/ring-core "1.7.1"]
[ring/ring-codec "1.1.2"] [ring/ring-codec "1.1.2"]
;; neo4j ;; neo4j
@ -36,7 +36,7 @@
[buddy/buddy-hashers "1.4.0" [buddy/buddy-hashers "1.4.0"
:exclusions [commons-codec]] :exclusions [commons-codec]]
[clj-time "0.15.2"] [clj-time "0.15.2"]
[markdown-clj "1.10.1"] [markdown-clj "1.10.0"]
[dorothy "0.0.7"]] [dorothy "0.0.7"]]
:profiles {:dev {:plugins [;; neo4j db :profiles {:dev {:plugins [;; neo4j db
@ -50,6 +50,7 @@
[jonase/eastwood "LATEST"] [jonase/eastwood "LATEST"]
[lein-bikeshed "LATEST"] [lein-bikeshed "LATEST"]
[lein-cloverage "LATEST"] [lein-cloverage "LATEST"]
[cider/cider-nrepl "0.22.2"]
[lein-kibit "LATEST"]]} [lein-kibit "LATEST"]]}
:uberjar {:aot :all :uberjar {:aot :all
:main wanijo.main}} :main wanijo.main}}

@ -16,15 +16,11 @@
:pw (hashers/derive pw) :pw (hashers/derive pw)
:uuid (neo4j/uuid)})) :uuid (neo4j/uuid)}))
(db/defquery merge-config (db/defquery init-config
"MERGE (c:dbconfig) "MERGE (c:dbconfig)
ON CREATE SET ON CREATE SET
c.installed_at = {now}, c.installed_at = {now},
c.db_version = 0, c.db_version = 0")
c.last_migration = ''
ON MATCH SET
c.last_migration = {now},
c.db_version = {version}")
(db/defquery config (db/defquery config
"MATCH (c:dbconfig) RETURN c") "MATCH (c:dbconfig) RETURN c")
@ -78,18 +74,11 @@
init-version-1]) init-version-1])
(defn run-migrations! [] (defn run-migrations! []
(neo4j/exec-query! merge-config {:now (neo4j/now-str) (neo4j/exec-query! init-config {:now (neo4j/now-str)})
:version (count migrations)})
(let [version (-> (neo4j/exec-query! config {}) (let [version (-> (neo4j/exec-query! config {})
first first
:c :c
:db_version)] :db_version)]
(println "got version" version "from db," (count migrations) "available") (if-let [to-run (nthrest migrations version)]
(when-let [to-run (nthrest migrations version)]
(println "running" (count to-run) "migrations")
(doseq [mig to-run] (doseq [mig to-run]
(println "running" mig) (mig)))))
(mig))))
(neo4j/exec-query! merge-config {:now (neo4j/now-str)
:version (count migrations)})
nil)

Loading…
Cancel
Save