gpt4 book ai didi

liquibase - 用 liquibase 改变柱长

转载 作者:行者123 更新时间:2023-12-04 17:32:50 31 4
gpt4 key购买 nike

我在使用 liquibase 更改 postgres 数据库中的列长度时遇到问题。

我有一个带有字段描述 varchar(300) 的表帐户。我想把它改成 varchar(2000)。

我在同一个文件中删除并重新创建了主键,所以我没有权限问题或架构/数据库名称或类似的东西。为了测试,我已经清除了数据表。

我在运行

<changeSet author="liquibase" id="sample">
<modifyDataType
columnName="description"
newDataType="varchar(2000)"
schemaName="accountschema"
tableName="account"/>
</changeSet>

我收到此错误文本,但我无法理解问题。该列的唯一约束是非空约束,我成功添加了一个单独的更改日志来删除此约束(忽略我不明白为什么这会影响扩展字段长度的事实)。

谁能指出我做错了什么?
  • FAILURE:构建失败,出现异常。
  • 什么地方出了错:

    任务 ':db-management:update' 执行失败。

    liquibase.exception.LiquibaseException: Unexpected error running Liquibase: Error parsing line 37 column 38 of src/main/changelog/db.changelog-accountdb-1.1.xml: cvc-complex-type.2.4.a: Invalid content was found starting with element 'modifyDataType'. One of '{"http://www.liquibase.org/xml/ns/dbchangelog/1.9":validCheckSum, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":preConditions, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":tagDatabase, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":comment, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":createTable, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropTable, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":createView, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":renameView, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropView, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":insert, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addColumn, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":sql, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":createProcedure, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":sqlFile, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":renameTable, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":renameColumn, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropColumn, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":modifyColumn, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":mergeColumns, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":createSequence, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":alterSequence, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropSequence, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":createIndex, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropIndex, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addNotNullConstraint, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropNotNullConstraint, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addForeignKeyConstraint, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropForeignKeyConstraint, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropAllForeignKeyConstraints, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addPrimaryKey, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropPrimaryKey, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addLookupTable, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addAutoIncrement, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addDefaultValue, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropDefaultValue, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":addUniqueConstraint, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":dropUniqueConstraint, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":customChange, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":update, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":delete, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":loadData, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":executeCommand, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":stop, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":rollback, "http://www.liquibase.org/xml/ns/dbchangelog/1.9":modifySql}' is expected.

  • 最佳答案

    您可以像这样增加列的大小:

    <changeSet author="liquibase" id="sample">
    <modifyDataType
    columnName="description"
    newDataType="varchar(2000)"
    tableName="account"/>
    </changeSet>

    关于liquibase - 用 liquibase 改变柱长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37319193/

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