0

I want my application to use r2dbc drive when running and jdbc to handle the database with Liquibase. I have this as a reference. It is possible by adding the correct configuration inside application.properties and build.gradle.kts to achieve that. Update and everything is working but not automatically. Do you have any suggestions?Spring's reference

1 Answers1

0

You have two options to use db migrations like Liquibase in a R2bc application.

  1. Till now Liquibase did not support R2dbc, and by default R2dbc and Jdbc can not be activated in a single Spring boot application. In a reactive Spring Boot application, although you added a Jdbc starter, it is not activated by default.

    But you can setup liquibase in a R2dbc application, and configure Liquibase Maven/Gradle plugin to migrate the database manually by Gradle tasks/Maven goals. See my example: liquibase-maven-r2dbc, make sure the db is running, and execute mvn liquibase:update in the project root.

    See the official guide of Liquibase Maven PLugin, https://docs.liquibase.com/tools-integrations/maven/workflows/using-liquibase-maven-plugin-and-springboot.html

  2. Use R2dbc Migrate directly, it is similar to Flyway but working with 2rdbc. See my example: r2dbc-migrate.

Hantsy
  • 8,006
  • 7
  • 64
  • 109