Liquibase gradle 插件 -> 多个更新日志文件

Liquibase gradle plugin -> Multiple changelog files

我正在使用 liquibase gradle 插件,我想指定多个变更日志文件而不是一个。 运行 的变更日志取决于某些条件。

liquibase {
   activities {
   main {      
      changeLogFile "liquibase-changelog.xml"
      url 'jdbc:mysql://localhost:3306/world'
      username 'XXX'
      password 'XXX'
     } 
  }
 runList = 'main'
}

是否可以有一组更新日志文件?

我猜你唯一可以做的开箱即用的事情就是制作 liquibase-changelog.xml 一个 "master" changeLog 文件,并根据 context.

您的 master-liqbuiase-changelog.xml 可能如下所示:

<databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">

    <include file="liquibase-changelog-1.xml" relativeToChangelogFile="true" context="your_condition_based_on_context"/>
    <include file="liquibase-changelog-2.xml" relativeToChangelogFile="true" context="your_other_condition_based_on_context"/>
    <!-- other changeLog files -->
</databaseChangeLog>