gpt4 book ai didi

Liquibase:检查是否设置了属性

转载 作者:行者123 更新时间:2023-12-04 00:46:47 24 4
gpt4 key购买 nike

如果设置了自定义属性,我找不到检查前置条件元素的方法。

到目前为止,我发现的有关此问题的信息是 here .正如票证注释所示,扩展 CustomPrecondition不修改 API 将无济于事。还有其他方法吗?

最佳答案

documentation描述 changeLogPropertyDefined 前置条件。

以下示例对我来说效果很好:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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-2.0.xsd">

<changeSet author="mark (generated)" id="mark-1">
<preConditions onFail="HALT">
<changeLogPropertyDefined property="testing" value="1"/>
</preConditions>

<createTable tableName="TEST001">
<column name="ID" type="VARCHAR(10)">
<constraints nullable="false"/>
</column>
<column name="X" type="VARCHAR(9)">
<constraints nullable="false"/>
</column>
<column name="Y" type="DECIMAL(7,2)"/>
<column name="Z" type="DECIMAL(7,2)"/>
</createTable>
</changeSet>

</databaseChangeLog>

我从 Maven 运行 liquibase。可以从命令行设置 testing 属性,如下所示:

mvn -Dtesting=1 compile

关于Liquibase:检查是否设置了属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10297583/

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