Search code examples
javadatabase-migrationliquibaseflywayr2dbc

Database migrations with R2DBC


I am new to R2DBC (https://r2dbc.io/). I would like to know whether r2dbc's ecosystem has a database migration tool/framework.

It seems Liquibase & Flyway depend on JDBC. Is there a plan for allowing those frameworks to support a r2dbc driver?

Any input or feedback welcome.


Solution

  • Steve's answer is correct hat R2DBC is primarily about interaction with the actual data. I'd like to add a different perspective.

    It's true that a reactive API does not provide any improvement during migrations. In fact, looking closely, migrations are part of the startup process which is typically synchronous, at least synchronized to some extent.

    Requiring JDBC for migration adds to complexity in such an application arrangement. You are required to include a JDBC driver to an existing R2DBC setup and you need to configure another database connection that points to the same database as with R2DBC. Both requirements are error-prone as they need to be configured to do the exact same thing.

    Nowadays, application configuration frameworks (Spring Boot, Micronaut, Quarkus) activate functionality when a certain library is available from the classpath. Having a JDBC driver configured boots functionality that isn't required for the application but required during bootstrapping and that is sort of a waste of resources.

    Ideally, you configure a single database connection technology that is reused for schema migration and for later data interaction within your application.

    Therefore it makes sense to ask Liquibase and Flyway to provide an R2DBC-based integration.