首页 > 解决方案 > 如何在 maven 项目中使用 liquibase-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。

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

标签: javaxmlmavenmigrationliquibase

解决方案


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 依赖项中添加 liquibase-modify-column.jar 并使用 ext:modifyColumn </ext:modifyColumn> 将使 modifyColumn 与最新的 liquibase 一起使用

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


推荐阅读