[database-migration-plugin] Is it possible to use wildcards in includes?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[database-migration-plugin] Is it possible to use wildcards in includes?

Marcel Overdijk
Is it possible to use wildcards in the include statements in de master changelog file?

E.g. something like:

-- grails-app/migrations/changelog.groovy
databaseChangeLog = {
        include file: "changelog/*.groovy"
}

This way 1 include would be sufficient to include all 'other' changelogs.

In Liquibase this possible using:
<includeAll path="some/path/changelog" />

I was not able to find any documentation for the format of the include files, so I'm wondering what is possible.
Reply | Threaded
Open this post in threaded view
|

Re: [database-migration-plugin] Is it possible to use wildcards in includes?

burtbeckwith
The DSL supports what the XML files support, plus arbitrary Groovy code. include expects a single file and includeAll includes all files in that directory. It'd be easy enough to loop through the files though:

new File('changelog').eachFileRecurse(groovy.io.FileType.FILES) {
   if (it.name.endsWith('.groovy')) include $it.path
}

You probably need to adjust the path to be relative though.

Burt

Marcel Overdijk wrote
Is it possible to use wildcards in the include statements in de master changelog file?

E.g. something like:

-- grails-app/migrations/changelog.groovy
databaseChangeLog = {
        include file: "changelog/*.groovy"
}

This way 1 include would be sufficient to include all 'other' changelogs.

In Liquibase this possible using:
<includeAll path="some/path/changelog" />

I was not able to find any documentation for the format of the include files, so I'm wondering what is possible.
Reply | Threaded
Open this post in threaded view
|

Re: [database-migration-plugin] Is it possible to use wildcards in includes?

Marcel Overdijk
In reply to this post by Marcel Overdijk
Not explicitly documented, but this works:

includeAll path: "some/path/changelogs"