Home:ALL Converter>Liquibase multiple changelog execution

Liquibase multiple changelog execution

Ask Time:2019-05-24T20:15:15         Author:Nat4j

Json Formatter

I'm using SpringLiquibase for liquibase configuration, below configuration works fine with single changelog file (sql formatted)

@Configuration
@Slf4j
public class LiquibaseConfiguration {

  @Inject
  private DataSource dataSource;

  @Bean
  public SpringLiquibase liquibase() {
    log.info("################## Entering into liquibase #################");
    SpringLiquibase liquibase = new SpringLiquibase();
    liquibase.setDataSource(dataSource);
    liquibase.setChangeLog("classpath:schema/update-schema-01.sql");
    // Configure rest of liquibase here...
    // ...
    return liquibase;
  }
}

In my application, i may need to run more than one changelog files and i couldn't make such execution,
I tried to feed multiple changelogs as follows,

liquibase.setChangeLog("classpath:schema/update-schema-01.sql");

liquibase.setChangeLog("classpath:schema/update-schema-02.sql");

the last one changelog file alone getting executed.

liquibase.setChangeLog("classpath:schema/*.sql");

Getting error as liquibase.exception.ChangeLogParseException: java.io.IOException: Found 2 files that match classpath:schema/*.sql

Please suggest a way to includeAll changelogs here.

Author:Nat4j,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/56292517/liquibase-multiple-changelog-execution
yy