Rollback using Spring Boot Application in Liquibase

60 Views Asked by At

I have a module in my project which contains Liquibase Changelogs and Changesets The module contains one simple java class which calls Liquibase and executes all the changesets present in the changelog: The java file is something like this:

package com.project.pp1.app;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;


@Configuration
@SpringBootApplication
public class LiquiBaseApp{
    
    public static void main(String[] args) {
        SpringApplication.run(LiquiBaseApp.class, args);
    }
}

After building the module and using the batch file, the jar is called and using this current implementation is working fine and all the changesets are executed as per expectaion.

Using the property file the fileName column in the DATABASECHANGELOG table contains the classpath:/thepath

Now, for upgrading: in the changesets there are rollback tags also present containing the rollback scripts. I want to create a batch file which using the jar first runs the rollback-sql command using the tag and the changelog file provided using property or CLI and gives the rollback scripts which would be executed if rollback command is used.

The fileName value is something like this: classpath:/RELEASE1/db/changelog-RELEASE1.xml

At this point, I can even update the fileName column value by removing the classpath:/ from the prefix if there is some work-around.

I have created a batch file and tried multiple commands but could not receive any desrired results. I want to create a batch file that executes rollback-sql command. Please provide any documentation or a way to acheive this.

0

There are 0 best solutions below