【问题标题】:Passing parameters in sqlfile tag in liquibase 4.0在 liquibase 4.0 的 sqlfile 标签中传递参数
【发布时间】:2021-09-11 21:25:25
【问题描述】:

我正在制作一个简单的 CI/CD 管道,其中有一些我需要使用 liquibase 在 aws RDS 上运行的 sql 文件。这里的模式名称可以不同,并且取决于提取代码的分支。 createSchema.sql 文件中的示例 sql:

create schema if not exist '${schemaName}'

在我的 changelog.xml 文件中,我正在做这样的事情:

<changeSet author="liquibase-docs" id="sqlFile-example">
     <sqlFile 
        path="createSchema.sql"
        splitStatements="true"
        stripComments="true">
<property name="schemaName" value="test_order"/>
</sqlFile>
</changeSet>

但是这东西行不通。我也找不到任何关于在 liquibase 的外部文件中传递参数的可靠信息。请让我知道我需要做些什么来修复它。

【问题讨论】:

    标签: postgresql liquibase liquibase-sql


    【解决方案1】:

    我使用 Liquibase CLI,你可以从命令行传入参数(key=value):

    liquibase.bat 更新 -Dengine=myisam

    更多信息:https://docs.liquibase.com/tools-integrations/cli/home.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-23
      • 1970-01-01
      • 2020-05-15
      • 2017-10-16
      • 1970-01-01
      • 2017-08-11
      • 2022-01-22
      • 1970-01-01
      相关资源
      最近更新 更多