weavejester / ragtime

Database-independent migration library
Eclipse Public License 1.0
610 stars 85 forks source link

Issue 58 added one way to specify custom dir #65

Closed ThomasMeier closed 9 years ago

ThomasMeier commented 9 years ago

Not absolutely sure it fits with how ragtime is put together. But it matches what I think some people are asking for, to specify a directory from which to search for sql files via plugin options. I'm assuming here that a lot of people are using the leiningen plugin. In which case there is no way to pass a custom directory to load the sql files. So the sql.files namespace will use its default directory. What this addition does is look at the ragtime plugin options for a specified directory. Example usage would be:

:plugins [[ragtime/ragtime.lein "0.3.8"]]
:ragtime {:migrations  ragtime.sql.files/migrations
               :migrations-dir "src/sql/migs"
               :database "jdbc:postgresql://localhost:5432/test_ragtime?user=postgres"}

I'd like that better than having to wade through Joplin.

weavejester commented 9 years ago

The ragtime.sql.files project has no connection to Leiningen, so it shouldn't refer to the project.clj file in any way, or assume it even exists.

The most obvious way to solve this that I can think of, is to change the migrations argument to be an s-expression instead of just a var name.

ThomasMeier commented 9 years ago

Roger that.

martintrojer commented 9 years ago

@ThomasMeier Have a look at https://github.com/juxt/joplin (which is built upon ragtime) and has this very feature.

ThomasMeier commented 9 years ago

@martintrojer Thanks, but I'd prefer to stick with ragtime, I'll just define a custom function to handle directory for now.