liquibase4s / liquibase4s   1.0.0

Apache License 2.0 GitHub

Liquibase Migrations For Scala

Scala versions: 3.x 2.13 2.12

liquibase4s - Liquibase Migrations For Scala

Scala Steward badge Continuous Integration codecov Latest version

liquibase4s is a simple, idiomatic wrapper library to run Liquibase migrations in Scala. We currently support Identity, scala.concurrent.Future and cats.effect.IO.


Builds are available for Scala 2.12, 2.13 and 3.

libraryDependencies ++= Seq(
  "io.github.liquibase4s" %% "liquibase4s-core" % "1.0.0",
  // if you want to use cats.effect.IO
  "io.github.liquibase4s" %% "liquibase4s-cats-effect" % "1.0.0",

Getting Started

To run liquibase migrations you need to create a LiquibaseConfig and construct a Liquibase instance. The default implementation uses Identity which means migrations will run synchronously.

import io.github.liquibase4s.{Liquibase, LiquibaseConfig}

val config: LiquibaseConfig = LiquibaseConfig(
  url = "jdbc:h2:mem:testdb",
  user = "test",
  password = "test",
  driver = "org.h2.Driver",
  changelog = "db/changelog/test.xml",

Liquibase(config).migrate() // returns Unit in case of success or throws Exception

Alternatively you can use scala.concurrent.Future to run migrations asynchronously.

import scala.concurrent.Future
import io.github.liquibase4s.FutureMigrationHandler._


Liquibase[Future](config).migrate() // returns Future[Unit]

liquibase4s-cats-effect provides support for cats.effect.IO.

import cats.effect.IO
import io.github.liquibase4s.cats.CatsMigrationHandler._

Liquibase[IO](config).migrate() // returns IO[Unit]


Contributions to liquibase4s are very welcome.