-
Notifications
You must be signed in to change notification settings - Fork 48
Source path assumptions should be documented #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It's supposed to create the migration file(s) in the path given for that migrator target. So if that configuration is correct, everything should work fine. https://github.com/juxt/joplin/blob/master/joplin.core/src/joplin/core.clj#L171 You should not create new migrations with paths part of their names, like 'lein joplin create foo/bar/baz/miy-migration" -- joplin expects a flat file structure inside the configured folder. |
That wasn't my point. Since namespace names should correspond to paths on the classpath, Joplin-generated migrations have to make some assumptions about ns names w/o knowing anything about source paths configuration. And the assumption made at the moment is
e.g. I couldn't get it to work with |
I just got bit by this and thought I'd leave my solution here for anyone else who runs into it. My source layout is a bit more nested than usual clj projects. My migrations live in namespaces starting with (defn drop-first-part* [path delimiter]
(->> (string/split path #"/")
rest
(drop 2) ;; This is the change from the original implementation of this function.
(interpose delimiter)
(apply str)))
;; later...
(with-redefs [joplin.core/drop-first-part drop-first-part*]
(joplin/migrate-db migration-conf)) Perhaps a fix the library could make is to allow |
Sounds like a good idea, I'd be happy to merge |
I've just stumbled upon the same issue trying to put all joplin stuff inside I could get it to create migration files by providing
|
Same issue, I used tomconnors fix and have to |
Joplin's "create migration" task uses fairly naïve assumptions about source directory layout for code-driven migrators (e.g. Cassandra). It strips off the first path part and turns the rest into a namespace name. This means if you try to use
src/joplin
instead ofjoplin
, you'll get compilation errors thatare not very pleasant to debug.
I think this at least should be documented, and maybe even made optional configurable with a function defined with a migrator attribute.
The text was updated successfully, but these errors were encountered: