Home

Awesome

The development of this library has been discontinued.

The liquibase-sbt-plugin is a plugin for the Simple Build Tool (SBT) for running LiquiBase commands.

This version only supports SBT 0.7.x.

Liquibase is a database-independent library for tracking, managing and applying database changes.

#Setup#

  1. Define a dependency on the liquibase-sbt-plugin in your plugin definition file, project/plugins/Plugins.scala

     import sbt._
    
     class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
       val liquibaseSbtSnapshots = "Liquibase SBT Snapshots Repository" at "http://sdb.github.com/maven/snapshots"
       val liquibase = "com.github.sdb" % "liquibase-sbt-plugin" % "0.0.1-SNAPSHOT"
     }
    
  2. Mixin the LiquibasePlugin trait in your project file, e.g. project/build/TestProject.scala

     import sbt._
     import com.github.sdb.sbt.liquibase.LiquibasePlugin
    
     class TestProject(info: ProjectInfo) extends DefaultProject(info)
       with LiquibasePlugin {
       ...
     }
    
  3. Configure

     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"
    
       // provide the parameters for running liquibase commands
       lazy val liquibaseChangeLogFile = "config" / "db-changelog.xml"
       lazy val liquibaseDriver = "org.h2.Driver"
       lazy val liquibaseUrl = "jdbc:h2:mem:"
       
       // provide username and password for database access
       override lazy val liquibaseUsername = "sa"
       override lazy val liquibasePassword = ""
     }
    

Note that this a very basic way to configure the plugin. Take a look at this gist for a more realistic example.

#Usage#

The following actions are available: