liquibase / liquibase-gradle-plugin

A Gradle plugin for Liquibase
Other
197 stars 57 forks source link

No plugin support for passing any "contexts" argument through to liquibase #8

Closed scrain closed 8 years ago

scrain commented 8 years ago

Does not appear to be any easy way to pass "contexts" through to liquibase using the plugin. I've implemented something similar to what is found here but it seems like it should be more directly supported.

Happy to help with a pull request, but would like to know if a) if there is agreement this should be addressed... and b) what the suggested approach might be.

Thanks

DKroot commented 8 years ago

We do this fine in our projects. I have to say we're still on 3.2, but plan to upgrade to the latest version soon.

liquibase {
    activities {
        def liquibaseScript = 'sql/Release-Migration/Release-Delta.xml'
        if (file(liquibaseScript).exists()) {
            main {
                changeLogFile liquibaseScript
                url db
                username dbUser
                password dbPwd
                //driver 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
                contexts env
                // changeLogParameters([ myToken: 'myvalue', second: 'secondValue'])

                // Failed SQL is logged on DEBUG level.
                logLevel 'debug'
            }
        }
    }
}
stevesaliman commented 8 years ago

Thanks for the assist @DKroot.

@scrain All of the methods inside an activity block are simply passed on to Liquibase as if they were specified on the command line. So in the above example, the username dbUser method is the same as --username=dbUser etc. I've updated the documentation to hopefully avoid future confusion.

scrain commented 8 years ago

Thanks for the insight and quick response.