liquibase4s / liquibase4s

Liquibase Migrations For Scala

Version Matrix

liquibase4s - Liquibase Migrations For Scala

Continuous Integration

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 and 2.13.

libraryDependencies ++= Seq(
  "io.github.liquibase4s" %% "liquibase4s-core" % "0.1.0",
  // if you want to use cats.effect.IO
  "io.github.liquibase4s" %% "liquibase4s-cats-effect" % "0.1.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.