sbt-liquibase icon indicating copy to clipboard operation
sbt-liquibase copied to clipboard

Run Liquibase before test with different settings.

Open llinder opened this issue 10 years ago • 0 comments

I was hoping to use Liquibase with H2 for tests and adjust settings in just the test scope as follows:

(test in Test) <<= (test in Test) dependsOn (liquibaseUpdate in Test), liquibaseDriver := "com.mysql.jdbc.Driver", liquibaseUrl := "jdbc:mysql://127.0.0.1:3306/mydb;", liquibaseDriver in Test := "org.h2.Driver", liquibaseUrl in Test := "jdbc:h2:mem:mydb;

When I try this only the default (non scoped) values are picked up during tests. Further more dependencies scoped as % "test" are not available to the Liquibase plugin in the test scope.

After digging into the code I was able to get all of this to work by making a few changes including switching to AutoPlugin which was introduced in 0.13.5. I am a little reluctant to submit a pull request not knowing if it will be accepted, if others have a need for this functionality or if its a blocker for folks to use SBT 0.13.5+.

Nonetheless I figured it was worth opening it for discussion in case its of value to others.

For review here are the changes I am proposing: https://github.com/llinder/sbt-liquibase/commit/e852752bdddd0fdd176169b8161d30407daf2e97

llinder avatar Dec 05 '14 14:12 llinder