Guest User

Untitled

a guest
Jun 18th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. import sbt._
  2. import com.github.sdb.sbt.liquibase._
  3.  
  4. class TestProject(info: ProjectInfo) extends DefaultProject(info) with LiquibasePlugin {
  5.  
  6. // declare the required database driver as a runtime dependency
  7. val h2 = "com.h2database" % "h2" % "1.2.143" % "runtime"
  8.  
  9. // fetch the running mode from the system properties (dev, prd, ...)
  10. lazy val mode = system[String]("mode").get.getOrElse(null)
  11.  
  12. // provide the parameters for running liquibase commands
  13. lazy val liquibaseChangeLogFile = "config" / "db-changelog.xml"
  14. lazy val liquibaseDriver = "org.h2.Driver"
  15.  
  16. // the URL depending on the mode
  17. lazy val liquibaseUrl = mode match {
  18. case "prd" => "jdbc:h2:tcp://dbserv:8084/~/sample"
  19. case _ => "jdbc:h2:file:sample"
  20. }
  21.  
  22. // the contexts to run
  23. override lazy val liquibaseContexts = mode
  24.  
  25. // define an environment for reading props from pwd.properties
  26. lazy val liquibaseEnv = new BasicEnvironment
  27. {
  28. def log = TestProject.this.log
  29. def envBackingPath = "pwd.properties"
  30. lazy val username = property[String]
  31. lazy val password = property[String]
  32. }
  33.  
  34. // provide username and password as defined in pwd.properties
  35. override lazy val liquibaseUsername = liquibaseEnv.username.get.getOrElse(null)
  36. override lazy val liquibasePassword = liquibaseEnv.password.get.getOrElse(null)
  37. }
Add Comment
Please, Sign In to add comment