Flyway
libraryDependencies += "com.avast" %% "sst-flyway" % "0.18.4"
This subproject initializes Flyway
which can be used to do automated SQL DB migrations. See the documentation of Flyway
on how to go about that.
The method make
requires javax.sql.DataSource
which you can for example obtain from doobie-hikari
subproject:
import cats.effect.Resource
import com.avast.sst.doobie.DoobieHikariModule
import com.avast.sst.flyway.FlywayModule
import zio.Task
import zio.interop.catz.*
for {
doobieTransactor <- DoobieHikariModule.make[Task](???, ???, ???, ???)
flyway <- Resource.eval(FlywayModule.make[Task](doobieTransactor.kernel, ???))
_ <- Resource.eval(Task.effect(flyway.migrate()))
} yield ()