How to start Liquibase migrations before MyBatis mapping in a SpringBootApplication? - spring-boot

How to start Liquibase migrations before MyBatis mapping in a SpringBootApplication?
Is it an official way for it? I tried DependsOn it doesn't work, exposing cyclic dependency

Liquibase has a tutorial on how to use Liquibase with Spring boot and Maven. You could start from there.

Related

Is it possible to apply versioning on just data.sql and not schema.sql for Flyway in Spring Boot?

I am trying to use Flyway. I understand that it is used for migration purposes. My use case is to load data from data.sql in my classpath. And I will want to add more data so I will need another data.sql file in future.
Is it possible to version just the data.sql file using Flyway? I am using Spring Boot to configure this.
it might be worth while starting with the Flyway Migrate documentation to help with understanding Flyway versioning scripts and naming conventions.
https://flywaydb.org/documentation/concepts/migrations

Spring boot r2dbc and jdbc Liquibase does not update on application start

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
You have two options to use db migrations like Liquibase in a R2bc application.
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
Use R2dbc Migrate directly, it is similar to Flyway but working with 2rdbc. See my example: r2dbc-migrate.

Liquibase migration not working on Spring Boot 2.4.3 application startup

I have updated Spring Boot version to 2.4.3. After the upgrade, liquibase migrations are not working. No error messages or logs also seen for this.
I have the following properties set in my application.yaml
spring:
liquibase:
change-log: classpath:liquibase/changelog.xml
Is any other change required in the newer spring boot upgrades?
The issue was with the order in which the beans were getting executed. Redis bean was getting executed before liquibase and failing.

Liquibase and Hibernate ddl-auto=update with Spring Boot

I am integrating liquibase in Spring boot project. I am planning to let hibernate run DB schema changes and run remaining DML queries via liquibase.
Is it good practice to manage DB changes via both Liquibase and
Hibernate at the same time ?
Are there any cons using the same?
Why not running everything from liquibase script? https://docs.spring.io/spring-boot/docs/current/reference/html/howto-database-initialization.html#howto-execute-liquibase-database-migrations-on-startup

MongoDB dependency for spring

I am a beginner to mongodb and spring, so I apologise if the question is silly.
I want to use mongodb in my spring application. I created a maven project, what dependencies do I need to add in my pom.xml file.
I can see some jars like spring-boot-starter-data-mongodb is added but can find no explantions about it. What does it do exactly?

Resources