Skip to content

migrate does not work if lein project :src-paths set to something other than "src/" #61

@intronic

Description

@intronic

Hi,

This took me ages to figure out. (migrate) was not working following the example code.
eg, migrate always returned nil, doing nothing:

user> (migrate)
nil

I found out that (migrate) calls (list-migrations) calls ns-file which uses *src-directory* to build a path to your migrations.clj file, so if you have non-default :src-paths you will need to bind *src-directory* to your path before calling migrate, and then your migrations will work:

user> (binding [*src-directory* "src/clojure/"] (migrate))
your-migration1-runs-now
your-migration2-runs-now
nil

My project.clj has these lines, which were the cause of the problem:

  :source-paths      ["src/clojure"]
  :java-source-paths ["src/java"]

Its not exacltly a bug, and I dont know if its possible that lobos could find the actual src path, but maybe this note helps someone else.

Cheers

Mike

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions