yogthos / migratus

MIGRATE ALL THE THINGS!
642 stars 93 forks source link

:migration-dir is always have value "migrations/" #188

Closed mikeananev closed 4 years ago

mikeananev commented 4 years ago

Hi!

:migration-dir is always have value "migrations/" when calling (migratus/create config "anyname")

Mike

yogthos commented 4 years ago

Hmm, I'm not able to reproduce this locally. The code for create is here

(defn create [config name migration-type]
  (let [migration-dir  (find-or-create-migration-dir
                         (utils/get-parent-migration-dir config)
                         (utils/get-migration-dir config))
        migration-name (->kebab-case (str (timestamp) name))]
    (doseq [mig-file (proto/migration-files* migration-type migration-name)]
      (.createNewFile (io/file migration-dir mig-file)))))

it checks for the parent migration dir and the migration dir to create the path, and both functions check the value in the config. If you run it with

(let [config {:migration-dir "foo"}]
    (find-or-create-migration-dir
      (utils/get-parent-migration-dir config)
      (utils/get-migration-dir config)))

The result is "resources/foo" which is what I'd expect.

mikeananev commented 4 years ago

Hi, Dmitry!

My mistake. I put :migration-dir inside :db section. Thanks.