2021-10-23
Liquibase configuration

Spring Boot and Liquidbase : how to change the default path and filename

https://sylvainleroy.com/wp-admin/options-general.php?page=ad-inserter.php#tab-2

This article is a hint how to change the default path and name for the liquibase changeset when you are using Boot.

TL;DR


.liquibase.changeLog=classpath:db/liquibase-changeLog.xml

Javadoc

What is Liquibase ?

liquibase logo 250
Liquibase framework logo

Liquibase is an open source database-independent library for tracking, managing and applying database schema changes. It was started in 2006 to allow easier tracking of database changes, especially in an agile development environment.

Basically, you define your database schema, the successive iterations and upgrades in changesets and liquibase will keep and maintain a database log and upgrade automatically your database instances.

What is Boot ?

Spring Boot makes it easy to create stand-alone, production-grade based Applications that you can “just run”.

It”s an opinionated view of the platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.

The default Boot configuration

By default, boot is looking for your changeset stored in your classpath. The path your changeset should be located is :


classpath:/db/changelog/db.changelog-master.yaml

The choice is rather dubious. They are using yaml and the weird file extension yaml instead of yml. Most of Liquibase documentation is using XML.

I have been looking how to change this ugly property, and without rewriting my own Liquibase Boot configuration bean.

Here is the trick :


.liquibase.changeLog=classpath:db/liquibase-changeLog.xml

If you are interested about Java articles , have a look there;

 

Next to read  SonarQube plugins for AngularJS and Javascript you may not know

Sylvain Leroy

Senior Software Quality Manager and Solution Architect in Switzerland, I have previously created my own company, Tocea, in Software Quality Assurance. Now I am offering my knowledge and services in a small IT Consulting company : Byoskill and a website www.byoskill.com Currently living in Lausanne (CH)

View all posts by Sylvain Leroy →