Skip to content

Commit eef5417

Browse files
committed
WIP
1 parent 5e8b06b commit eef5417

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
@@ -23,6 +23,8 @@ lazy val root = project
2323
doobieHikari,
2424
doobieHikariPureConfig,
2525
example,
26+
flyway,
27+
flywayPureConfig,
2628
http4sClientBlaze,
2729
http4sClientBlazePureConfig,
2830
http4sServer,
@@ -101,6 +103,23 @@ lazy val example = project
101103
)
102104
)
103105

106+
lazy val flyway = project
107+
.in(file("flyway"))
108+
.settings(commonSettings)
109+
.settings(
110+
name := "sst-flyway",
111+
libraryDependencies += Dependencies.flywayCore
112+
)
113+
114+
lazy val flywayPureConfig = project
115+
.in(file("flyway-pureconfig"))
116+
.dependsOn(flyway)
117+
.settings(commonSettings)
118+
.settings(
119+
name := "sst-flyway-pureconfig",
120+
libraryDependencies += Dependencies.pureConfig
121+
)
122+
104123
lazy val http4sClientBlaze = project
105124
.in(file("http4s-client-blaze"))
106125
.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
@@ -5,6 +5,7 @@ object Dependencies {
55
val catsEffect = "org.typelevel" %% "cats-effect" % "2.0.0"
66
val doobie = "org.tpolecat" %% "doobie-core" % Versions.doobie
77
val doobieHikari = "org.tpolecat" %% "doobie-hikari" % Versions.doobie
8+
val flywayCore = "org.flywaydb" % "flyway-core" % "6.0.7"
89
val http4sBlazeClient = "org.http4s" %% "http4s-blaze-client" % Versions.http4s
910
val http4sBlazeServer = "org.http4s" %% "http4s-blaze-server" % Versions.http4s
1011
val http4sDsl = "org.http4s" %% "http4s-dsl" % Versions.http4s

0 commit comments

Comments
 (0)