Spring Boot team've released a R2DBC support recently. This, absence of ready solutions, and absence of proper support docker-entrypoint-initdb.d in mssql-docker had inspired me to make my own.

Github.

Maven coordinates:

(All of them requires Java >=11). Update: Java 8 has been supported since 1.0.3.

Spring Boot Starter

(requires Spring Boot >= 2.3.0.M3)

<dependency>

<groupId>name.nkonev.r2dbc-migrate</groupId>

<artifactId>r2dbc-migrate-spring-boot-starter</artifactId>

<version>0.0.28</version>

</dependency>

Library only

<dependency>

<groupId>name.nkonev.r2dbc-migrate</groupId>

<artifactId>r2dbc-migrate-core</artifactId>

<version>0.0.28</version>

</dependency>

Features

* PostgreSQL, Microsoft SQL Server, MySQL support

* Convention-based file names, for example V3__insert_to_customers__split,nontransactional.sql

* It waits until database have been started, there is test query, and, optionally, validation result of. This can be useful to initial load data into database with docker-compose

* Supports migrations files larger than -Xmx - file will be splitted line-by-line (split modifier), then it will be loaded by chunks into database

* Lock support, that make you able to start number of replicas your microservice, without care of migrations will collide each other

* Each migration runs in the separated transaction

* It also supports nontransactional migrations, due to SQL Server prohibits CREATE DATABASE in the transaction

* Docker image

All available configuration options are in R2dbcMigrateProperties class.

All available variants how to configure Spring Boot application you can find here.

Here is example of usage Spring Boot starter in demo application which responds table content via http: