addSbtPlugin("io.github.davidmweber" % "flyway-sbt" % "5.0.0-RC2")
Name | Description |
---|---|
flywayMigrate | Migrates the database |
flywayClean | Drops all objects in the configured schemas |
flywayInfo | Prints the details and status information about all the migrations |
flywayValidate | Validates the applied migrations against the ones available on the classpath |
flywayBaseline | Baselines an existing database, excluding all migrations up to and including baselineVersion |
flywayRepair | Repairs the metadata table |
flywayInfo | Prints information about the migration |
The Flyway SBT plugin can be configured in the following ways:
enablePlugins(FlywayPlugin) flywayUrl := "jdbc:hsqldb:file:target/flyway_sample;shutdown=true" flywayUser := "SA" flywayLocations += "org.flywaydb.sample.migration" flywaySchemas := Seq("schema1", "schema2", "schema3") flywayPlaceholders := Map( "keyABC" -> "valueXYZ", "otherplaceholder" -> "value123" )
> sbt -Dflyway.user=myUser -Dflyway.schemas=schema1,schema2 -Dflyway.placeholders.keyABC=valXYZ
System properties override Plugin configuration
The flywayBaseSettings
value of the Flyway plugin provides base configuration and task definitions for the plugin. This can be reused in custom configurations other than the those provided for the runtime and test configurations, if projects require it. These settings may be reused as follows:
enablePlugins(FlywayPlugin) lazy val CustomConfig = config("custom") describedAs "A custom config." extend Runtime lazy val customSettings: Seq[Def.Setting[_]] = Seq( flywayUser := "customUser", flywayPassword := "customPassword", flywayUrl := "jdbc:driver://host:port/db", ... ) lazy val app = (project in file("app")). settings(inConfig(CustomConfig)(FlywayPlugin.flywayBaseSettings(CustomConfig) ++ customSettings): _*)