Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sbt._
- import com.github.sdb.sbt.liquibase._
- class TestProject(info: ProjectInfo) extends DefaultProject(info) with LiquibasePlugin {
- // declare the required database driver as a runtime dependency
- val h2 = "com.h2database" % "h2" % "1.2.143" % "runtime"
- // fetch the running mode from the system properties (dev, prd, ...)
- lazy val mode = system[String]("mode").get.getOrElse(null)
- // provide the parameters for running liquibase commands
- lazy val liquibaseChangeLogFile = "config" / "db-changelog.xml"
- lazy val liquibaseDriver = "org.h2.Driver"
- // the URL depending on the mode
- lazy val liquibaseUrl = mode match {
- case "prd" => "jdbc:h2:tcp://dbserv:8084/~/sample"
- case _ => "jdbc:h2:file:sample"
- }
- // the contexts to run
- override lazy val liquibaseContexts = mode
- // define an environment for reading props from pwd.properties
- lazy val liquibaseEnv = new BasicEnvironment
- {
- def log = TestProject.this.log
- def envBackingPath = "pwd.properties"
- lazy val username = property[String]
- lazy val password = property[String]
- }
- // provide username and password as defined in pwd.properties
- override lazy val liquibaseUsername = liquibaseEnv.username.get.getOrElse(null)
- override lazy val liquibasePassword = liquibaseEnv.password.get.getOrElse(null)
- }
Add Comment
Please, Sign In to add comment