如何在maven项目中使用liquidbase -modify-column.jar ?



<databaseChangeLog 
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" 
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd 
http://www.liquibase.org/xml/ns/dbchangelog 
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="Administrator" id="20" runOnChange="true"> 
<modifyColumn tableName="TEST_TABLE">
<column name="FIELD_NAME" type="java.sql.Types.VARCHAR(250)" />
</modifyColumn>
</changeSet>
</databaseChangeLog>

我是liquibase的新手,谁能帮助我如何使用liquibase-modify-column jar来使用liquibase 3.6.3中的modifyColumn功能来解决当前的问题?

cvc-complex-type.2.4。a:发现以元素"{"http://www.liquibase.org/xml/ns/dbchangelog":modifyColumn}"开头的无效内容. {"http://www.liquibase.org/xml/ns/dbchangelog":comment, "http://www.liquibase.org/xml/ns/dbchangelog":createTable, "http://www.liquibase.org/xml/ns/dbchangelog":dropTable, "http://www.liquibase.org/xml/ns/dbchangelog":createView, "http://www.liquibase.org/xml/ns/dbchangelog":renameView, "http://www.liquibase.org/xml/ns/dbchangelog":dropView, "http://www.liquibase.org/xml/ns/dbchangelog":insert,"http://www.liquibase.org/xml/ns/dbchangelog":addColumn, "http://www.liquibase.org/xml/ns/dbchangelog":sql, "http://www.liquibase.org/xml/ns/dbchangelog":createProcedure, "http://www.liquibase.org/xml/ns/dbchangelog":dropProcedure, "http://www.liquibase.org/xml/ns/dbchangelog":sqlFile, "http://www.liquibase.org/xml/ns/dbchangelog":renameTable, "http://www.liquibase.org/xml/ns/dbchangelog":renameColumn"http://www.liquibase.org/xml/ns/dbchangelog"http://www.liquibase.org/xml/ns/dbchangelog" dropColumn:"http://www.liquibase.org/xml/ns/dbchangelog" mergeColumns:"http://www.liquibase.org/xml/ns/dbchangelog" modifyDataType:"http://www.liquibase.org/xml/ns/dbchangelog" createSequence:"http://www.liquibase.org/xml/ns/dbchangelog" alterSequence:"http://www.liquibase.org/xml/ns/dbchangelog" dropSequence:方法createIndex,"http://www.liquibase.org/xml/ns/dbchangelog":dropIndex, "http://www.liquibase.org/xml/ns/dbchangelog":addNotNullConstraint, "http://www.liquibase.org/xml/ns/dbchangelog":dropNotNullConstraint, "http://www.liquibase.org/xml/ns/dbchangelog":addForeignKeyConstraint, "http://www.liquibase.org/xml/ns/dbchangelog":dropForeignKeyConstraint, "http://www.liquibase.org/xml/ns/dbchangelog":dropAllForeignKeyConstraints"http://www.liquibase.org/xml/ns/dbchangelog":addPrimaryKey, "http://www.liquibase.org/xml/ns/dbchangelog":dropPrimaryKey, "http://www.liquibase.org/xml/ns/dbchangelog":addLookupTable, "http://www.liquibase.org/xml/ns/dbchangelog":addAutoIncrement, "http://www.liquibase.org/xml/ns/dbchangelog":addDefaultValue, "http://www.liquibase.org/xml/ns/dbchangelog":dropDefaultValue"http://www.liquibase.org/xml/ns/dbchangelog"http://www.liquibase.org/xml/ns/dbchangelog" addUniqueConstraint:"http://www.liquibase.org/xml/ns/dbchangelog" dropUniqueConstraint:"http://www.liquibase.org/xml/ns/dbchangelog" customChange:更新"http://www.liquibase.org/xml/ns/dbchangelog":删除"http://www.liquibase.org/xml/ns/dbchangelog":"http://www.liquibase.org/xml/ns/dbchangelog" loadData: loadUpdateData,"http://www.liquibase.org/xml/ns/dbchangelog":executeCommand, "http://www.liquibase.org/xml/ns/dbchangelog":empty, "http://www.liquibase.org/xml/ns/dbchangelog":stop, "http://www.liquibase.org/xml/ns/dbchangelog":rollback, WC[##other:"http://www.liquibase.org/xml/ns/dbchangelog"], "http://www.liquibase.org/xml/ns/dbchangelog":modifySql}"。

使用的版本号:liquibase-3.6.3和liquibase-modify-column-3.1.jar

POM.xml

<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.6.3</version>
<dependencies>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-modify-column</artifactId>
<version>3.1</version>
</dependency> 
</dependencies>
</plugin>

<databaseChangeLog 
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" 
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd 
http://www.liquibase.org/xml/ns/dbchangelog 
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="Administrator" id="20" runOnChange="true"> 
<ext:modifyColumn tableName="TEST_TABLE">
<column name="FIELD_NAME" type="java.sql.Types.VARCHAR(250)" />
</ext:modifyColumn>
</changeSet>
</databaseChangeLog>

在liqubase依赖中添加liqubase -modify-column.jar并使用ext: modifyColumn & lt;/ext: modifyColumn>将使modifyColumn函数用于最新的liquidbase

https://forum.liquibase.org/t/custom-preconditions-as-an-extension-not-working/1428

<modifyColumn>不允许在您放置的地方。据我所知,在文档中<modifyColumn>根本不是liquidbase的有效数据类型。相反,您必须放置错误消息中提到的任何标记。您应该查看https://docs.liquibase.com/change-types/home.html以获取<changeSet>下可用的有效更改类型列表。根据您放入<modifyColumn>标签的内容,我猜您正在寻找modifyDataType。

最新更新