Commit 8ba50c7a authored by Johannes Knödtel's avatar Johannes Knödtel 🎶
Browse files

use luminus-migrations

parent 3178e08c
......@@ -21,6 +21,7 @@
[bouncer "1.0.0"]
[prone "1.1.4"]
[migratus "0.8.32"]
[luminus-migrations "0.2.6"]
[yesql "0.5.3"]
[to-jdbc-uri "0.3.0"]
[com.h2database/h2 "1.4.193"]
......
(ns gms.core
(:require [gms.handler :refer [app init destroy parse-port]]
[immutant.web :as immutant]
[gms.db.migrations :as migrations]
[luminus-migrations.core :as migrations]
[taoensso.timbre :as timbre]
[environ.core :refer [env]])
(:gen-class))
......
(ns gms.db.migrations
(:require
[migratus.core :as migratus]
[environ.core :refer [env]]
[to-jdbc-uri.core :refer [to-jdbc-uri]]))
(def migratus-config
{:store :database
:db {:connection-uri (to-jdbc-uri (:database-url env))}})
(defn parse-ids [args]
(map #(Long/parseLong %) (rest args)))
(defn migrate [args]
(case (first args)
"migrate"
(if (> (count args) 1)
(apply migratus/up migratus-config (parse-ids args))
(migratus/migrate migratus-config))
"rollback"
(if (> (count args) 1)
(apply migratus/down migratus-config (parse-ids args))
(migratus/rollback migratus-config))))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment