Skip to content

Commit

Permalink
pending migrations now returns info about missing (but applied) migra…
Browse files Browse the repository at this point in the history
…tors
  • Loading branch information
martintrojer committed Mar 26, 2015
1 parent 4c5ac44 commit 72b8fb4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions joplin.core/src/joplin/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[clj-time.format :as f]
[clojure.java.classpath :as classpath]
[clojure.java.io :as io]
[clojure.set]
[clojure.set :as set]
[clojure.string :as string]
[ragtime.core]
[ragtime.main]))
Expand Down Expand Up @@ -121,8 +121,11 @@ or resource folders inside a jar on the classpath"

(defn- get-pending-migrations [db migrations]
(let [migrations (->> migrations (map :id) set)
applied-migrations (set (ragtime.core/applied-migration-ids db))]
(clojure.set/difference migrations applied-migrations)))
applied-migrations (set (ragtime.core/applied-migration-ids db))
not-applied (set/difference migrations applied-migrations)
not-defined (set/difference applied-migrations migrations)]
(concat not-applied
(map #(str % "!MIGRATOR-MISSING!") not-defined))))

(defn do-migrate
"Perform migration on a database"
Expand Down

0 comments on commit 72b8fb4

Please sign in to comment.