Skip to content

Commit 7caabad

Browse files
committed
WIP
1 parent 4d1bf18 commit 7caabad

File tree

6 files changed

+54
-0
lines changed

6 files changed

+54
-0
lines changed

build.sbt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ lazy val root = project
2121
bundleMonixHttp4sBlaze,
2222
bundleZioHttp4sBlaze,
2323
example,
24+
flyway,
25+
flywayPureConfig,
2426
http4sClientBlaze,
2527
http4sClientBlazePureConfig,
2628
http4sServer,
@@ -77,6 +79,23 @@ lazy val example = project
7779
libraryDependencies += Dependencies.logbackClassic
7880
)
7981

82+
lazy val flyway = project
83+
.in(file("flyway"))
84+
.settings(commonSettings)
85+
.settings(
86+
name := "sst-flyway",
87+
libraryDependencies += Dependencies.flywayCore
88+
)
89+
90+
lazy val flywayPureConfig = project
91+
.in(file("flyway-pureconfig"))
92+
.dependsOn(flyway)
93+
.settings(commonSettings)
94+
.settings(
95+
name := "sst-flyway-pureconfig",
96+
libraryDependencies += Dependencies.pureConfig
97+
)
98+
8099
lazy val http4sClientBlaze = project
81100
.in(file("http4s-client-blaze"))
82101
.settings(commonSettings)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.avast.sst.flyway.pureconfig
2+
3+
import com.avast.sst.flyway.FlywayConfig
4+
import pureconfig.ConfigReader
5+
import pureconfig.generic.semiauto.deriveReader
6+
7+
trait ConfigReaders {
8+
9+
implicit val configReader: ConfigReader[FlywayConfig] = deriveReader
10+
11+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.avast.sst.flyway.pureconfig
2+
3+
object implicits extends ConfigReaders
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.avast.sst.flyway
2+
3+
final case class FlywayConfig(url: String, username: String, password: String, baselineOnMigrate: Boolean = false)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.avast.sst.flyway
2+
3+
import cats.effect.Sync
4+
import org.flywaydb.core.Flyway
5+
6+
object FlywayModule {
7+
8+
def make[F[_]: Sync](config: FlywayConfig): F[Flyway] = {
9+
Flyway
10+
.configure
11+
.dataSource(config.url, config.username, config.password)
12+
.baselineOnMigrate(config.baselineOnMigrate)
13+
.load()
14+
???
15+
}
16+
17+
}

project/Dependencies.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import sbt._
33
object Dependencies {
44

55
val catsEffect = "org.typelevel" %% "cats-effect" % "2.0.0"
6+
val flywayCore = "org.flywaydb" % "flyway-core" % "6.0.7"
67
val http4sBlazeClient = "org.http4s" %% "http4s-blaze-client" % Versions.http4s
78
val http4sBlazeServer = "org.http4s" %% "http4s-blaze-server" % Versions.http4s
89
val http4sDsl = "org.http4s" %% "http4s-dsl" % Versions.http4s

0 commit comments

Comments
 (0)