libraryDependencies += "de.lhns" %% "doobie-flyway" % "0.4.0"
def transactor(config: DbConfig): Resource[IO, Transactor[IO]] =
for {
ce <- ExecutionContexts.fixedThreadPool[IO](config.poolSizeOrDefault)
xa <- HikariTransactor
.newHikariTransactor[IO](
config.driverOrDefault,
config.url,
config.user,
config.password,
ce
)
_ <- Flyway(xa) { flyway =>
for {
info <- flyway.info()
_ <- flyway
.configure(_
.withBaselineMigrate(info)
.validateMigrationNaming(true)
)
.migrate()
} yield ()
}
} yield xa
This project uses the Apache 2.0 License. See the file called LICENSE.