tlberglund / groovy-liquibase

Yet Another Groovy DSL for Liquibase
Other
85 stars 66 forks source link

Cannot include migration scripts from classpath #28

Closed davidecavestro closed 11 years ago

davidecavestro commented 11 years ago

I'm trying to include on my root changelog an inclusion of another file.

I load the changelogs using a pattern matching Spring Resource Loader like "classpath*:migrations/rootChangelog.groovy"(see LiquibaseGriffonAddon.groovy). I've seen the inclusion is implemented at DatabaseChangeLogDelegate.groovy as new File(params.path).eachFileMatch(~/.*.groovy/) { file-> I guess that ties the script to be a regular file (from filesystem).

tlberglund commented 11 years ago

Is this fixed by tlberglund/groovy-liquibase#31? May I close it, with apologies for the slow follow-up?

davidecavestro commented 11 years ago

You're welcome. Only one problem: if I include a single file this way

include(path: 'migrations/20130301-mychange.groovy', relativeToChangelog: false)

then it fails trying to load migrations/20130301-mychange.groovy/20130301-mychange.groovy I've see this happens into line 122 of DatabaseChangeLogDelegate where it does the following

includeChangeLog(params.path + file.name)

Substantially the path param is used both to obtain the reference to the file (through resourceAccessor.getResources()) and also prepended to the actual file name.

I proposed a pull request. Hope this helps. Cheers Davide

mbruner commented 11 years ago

David, maybe you should use 'file' param instead 'path'?

include(file: 'migrations/20130301-mychange.groovy', relativeToChangelog: false)

I don't think the case when path contains only one file is essential

davidecavestro commented 11 years ago

Many thanks, you are simply right. I'm pretty sure I initially tried with file param, and it didn't work. But I have not tried that syntax after your fix! I just gave it a try and it works like a charm. So could you please ignore/discard my pull request? (I don't see a way to discard it)

One last thing: is there any forecast for having the fix available on public maven repos?

tlberglund commented 11 years ago

@davidecavestro It should already be in 0.7.6. Lemme know if you don't see it here.

davidecavestro commented 11 years ago

@tlberglund yes, now it's available even from maven central. I searched it on http://mvnrepository.com/artifact/com.augusttechgroup/groovy-liquibase-dsl but maybe there the new version has not been propagated yet. So everything works fine now and this ticket is solved for me (sorry for inaccuracy... I certainly had a crappy day) Many thanks

mbruner commented 11 years ago

@davidecavestro You may close pull request by yourself. Good luck!

tlberglund commented 11 years ago

@davidecavestro I'm just glad your problem is fixed! (Glad that @mbruner fixed it!) :boom: