yogthos / migratus

MIGRATE ALL THE THINGS!
647 stars 95 forks source link

Consider using log/debug in core/pending-list #130

Closed leblowl closed 6 years ago

leblowl commented 6 years ago

Instead of returning the info string in the pending-list command @ https://github.com/yogthos/migratus/blob/master/src/migratus/core.clj#L148, would you rather use log/debug as is used elsewhere in the library for other commands? Using pending-list command outside of the REPL (e.g. https://github.com/luminus-framework/luminus-template/blob/2e0312c0d7b1726ca52bbc80aadbfd6a44fe9b99/resources/leiningen/new/luminus/core/src/core.clj#L73-L75) will result in not seeing the output unless you print/log the return value.

yogthos commented 6 years ago

I'm thinking it might be good to return the migrations as a collection, and log/debug. This way the output is also useful programmatically:

(defn pending-list
  "List pending migrations"
  [config]
  (let [migrations-name  (->> (doto (proto/make-store config)
                                (proto/connect))
                              (uncompleted-migrations config)
                              (map proto/name))
        migrations-count (count migrations-name)]
    (log/debug "You have " migrations-count " pending migrations:\n"
               (clojure.string/join "\n" migrations-name))
    migrations-name))
leblowl commented 6 years ago

Awesome, I think that's a great idea.

yogthos commented 6 years ago

Ok great, I pushed out version 1.0.4 to Clojars with the update.

leblowl commented 6 years ago

thanks!