gpt4 book ai didi

database - liquibase可以在sql中有配置占位符吗

转载 作者:搜寻专家 更新时间:2023-10-30 19:52:58 25 4
gpt4 key购买 nike

liquibase在sql中可以有配置占位符吗?

示例代码:

<changeSet author="name" id="sql-example" runAlways="true" failOnError="true">
<sql>SELECT schema.admin_insert('PARAMETER_PLACEHOLDER')</sql>
</changeSet>

我可以在属性文件中定义参数值吗?以便 liquibase 替换属性文件中的参数值?

最佳答案

是的,你可以。 Liquibase 称这些为“变更日志参数”

http://www.liquibase.org/documentation/changelog_parameters.html

该页面的简短摘录:

Liquibase allows dynamic substitution of parameters in a changelog. The parameters to replace are described using the ${parameterName} syntax.

Configuring parameter values

Parameter values are looked up in the following order:

  • Passed as a parameter to your Liquibase runner (see Ant, command_line, etc. documentation for how to pass them)
  • As a JVM system property
  • In the parameters block (<property> Tag) of the DatabaseChangeLog file itself.

示例

<createTable tableName="${table.name}">
<column name="id" type="int"/>
<column name="${column1.name}" type="varchar(${column1.length})"/>
<column name="${column2.name}" type="int"/>
</createTable>

关于database - liquibase可以在sql中有配置占位符吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35804439/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com