liquibase roll back with spring boot

Stack Overflow Asked by user1999453 on October 7, 2020

I have a spring boot app(v2.3.3) which contains Liquidbase tool to create my table and initialise it.
When I start spring boos it is working fine, the tables are created and data inserted by using sql scripts and the Liquidbase configs are shown below:


    change-log: classpath:db/db.master.xml

src/main/resources/db: db.master.xml

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns=""
    <includeAll path="scripts/" relativeToChangelogFile="true"/>`enter code here`



  • 001.createTableAudit.sql
  • 002.insertDataTableAudit.sql

Let say I want to rollback 002.insertDataTableAudit.sql, is it possible rollback the insertDataTableAudit
when starting my Spring Boot App?

I know it can be done by maven : mvn liquibase:rollback but is it possible to acheive the same thing with Spring Boot?

Thanks in advance

One Answer

I don't think there's such functionality in spring boot out of the box. However you can create that functionality easily:

final Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection));
final Liquibase liquibase = new Liquibase("changelogpath", new CompositeResourceAccessor(new ClassLoaderResourceAccessor(), new FileSystemResourceAccessor()), database);
liquibase.rollback("TAG", (String) null);

Answered by bilak on October 7, 2020

Add your own answers!

Related Questions

Add AWS Cognito to angular application

1  Asked on November 16, 2021 by captainmorgan


How to analize which object owns the max memory

0  Asked on November 16, 2021 by loverszhaokai


enable_if, SFINAE and template parameters?

2  Asked on November 16, 2021


Dynamic ‘wait’ arg in Scrapy-splash

0  Asked on November 16, 2021 by winters


Grab a decimal between 2 strings regex

1  Asked on November 15, 2021 by lenny-gonzalez


Django , models object not displayed in views

2  Asked on November 15, 2021 by mxzero-mxzero


Re-render a sibling component using hooks

3  Asked on November 15, 2021 by programmer1


filter method returns empty array

3  Asked on November 15, 2021


Fit container inside image

1  Asked on November 15, 2021


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP