summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/flyway/src/FlywayModule.scala2
-rw-r--r--docs/pages/9 - Contrib Modules.md30
2 files changed, 31 insertions, 1 deletions
diff --git a/contrib/flyway/src/FlywayModule.scala b/contrib/flyway/src/FlywayModule.scala
index 3d0e7552..75c66e97 100644
--- a/contrib/flyway/src/FlywayModule.scala
+++ b/contrib/flyway/src/FlywayModule.scala
@@ -39,7 +39,7 @@ trait FlywayModule extends JavaModule {
case _ => true
}
.map(key -> _)
-
+
private implicit val flywayWriter = writer[String].comap[Flyway](_.toString)
def flywayInstance = T.command {
val jdbcClassloader = new URLClassLoader(jdbcClasspath().map(_.path.toIO.toURI.toURL).toArray)
diff --git a/docs/pages/9 - Contrib Modules.md b/docs/pages/9 - Contrib Modules.md
index 73875961..7bf29dc2 100644
--- a/docs/pages/9 - Contrib Modules.md
+++ b/docs/pages/9 - Contrib Modules.md
@@ -37,6 +37,36 @@ object project extends BuildInfo {
* `def buildInfoPackageName: Option[String]`, default: `None`
The package name of the object.
+
+
+### Flyway
+
+Enables you to configure and run [Flyway](https://flywaydb.org/) commands from your mill build file.
+The flyway module currently supports the most common flyway use cases with file based migrations.
+
+Configure flyway by overriding settings in your module. For example
+
+```scala
+object foo extends JavaModule with FlywayModule {
+ def scalaVersion = "2.12.8"
+
+ //region flyway
+ def flywayUrl = "jdbc:postgresql:myDb" // required
+ def flywayDriverDeps = Agg(ivy"org.postgresql:postgresql:42.2.5") // required
+ def flywayUser = "postgres" // optional
+ // def flywayPassword = "" // optional
+ //endregion
+}
+```
+
+Flyway will look for migration files in `db/migration` in all resources folders by default.
+
+You can then run common flyway commands like
+```
+mill foo.flywayClean
+mill foo.flywayInfo
+mill foo.flywayMigrate
+```
### Play Framework