Welcome to the home for the
sbt v1.x plugin for flyway. The user manual will tell you how to get started. This project is based on the original flyway-sbt that was in the flyway repository through version 4.2.1.
Adding Flyway to your build is very easy. First, update to your
project/plugin.sbt file to include:
addSbtPlugin("io.github.davidmweber" % "flyway-sbt" % "6.5.0")
Please check out Maven Central for versions of
flyway-sbt for previous versions of Flyway.
build.sbt to enable the plugin and configure the database access:
enablePlugins(FlywayPlugin) version := "0.0.1" name := "flyway-sbt-test1" libraryDependencies += "org.hsqldb" % "hsqldb" % "2.5.0" flywayUrl := "jdbc:hsqldb:file:target/flyway_sample;shutdown=true" flywayUser := "SA" flywayPassword := "" flywayLocations += "db/migration" flywayUrl in Test := "jdbc:hsqldb:file:target/flyway_sample;shutdown=true" flywayUser in Test := "SA" flywayPassword in Test := ""
Migrate your database using
sbt flywayMigrate or clean it using
Note that the
flywayTarget setting has been disabled due to this bug.
Building and testing
Note that from v5.0.0 onwards, the plugin has to be explicitly enabled using
enablePlugins(FlywayPlugin). This prevents Flyway actions triggering unrelated build activity and addresses this issue.
Build and test the plugin using
Early adopters should just publish a clone or fork of this repository locally:
git clone https://github.com/flyway/flyway-sbt.git cd flyway-sbt sbt publishLocal