gpt4 book ai didi

Liquibase 校验和验证失败

转载 作者:行者123 更新时间:2023-12-02 11:30:31 25 4
gpt4 key购买 nike

我在 Springboot 应用程序中使用 Liquibase (3.5.1)。我正在使用基于 SQL 的更改日志文件。添加新的变更集最终会显示先前变更集的校验和验证错误。

初始变更日志文件 -

--liquibase formatted sql
--changeset tanmoy:1
create table serviceInstances (
serviceId varchar(60),
orgId varchar(60),
spaceId varchar(60),
primary key (serviceId,orgId)
);

当添加这样的新变更集时 -

--changeset tanmoy:2
create table serviceBindings (
bindingId varchar(30) primary key,
serviceId varchar(30),
appId varchar(30),
timeStamp BIGINT
);

迁移失败并显示此错误日志 -

Caused by: liquibase.exception.ValidationFailedException: Validation Failed:
1 change sets check sum
classpath:/db/changelog/db.changelog-master.sql::1::tanmoy was: 7:d15516f48de6531d1727cca8c56ec95a but is now: 7:3c7718f34f78701e0d2cadbf8278c1fa

at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:266) ~[liquibase-core-3.5.1.jar:na]
at liquibase.Liquibase.update(Liquibase.java:210) ~[liquibase-core-3.5.1.jar:na]
at liquibase.Liquibase.update(Liquibase.java:192) ~[liquibase-core-3.5.1.jar:na]
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:434) ~[liquibase-core-3.5.1.jar:na]
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:391) ~[liquibase-core-3.5.1.jar:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
... 16 common frames omitted

不明白为什么之前的变更集的校验和被更改并且没有被验证。是因为我在更改日志文件中添加了新的更改集吗?如果是,那么我如何添加新的更改集?

最佳答案

流程层面上,所有流程都完成了incrementally 。例如,当我们创建一个表并想要对表进行更改时,我们会给您一个新的增量编号。有了这个数字,我们确定changes我们在我们创造的东西中制造的东西。这就像你在你的问题中添加了一些新的东西。因此,需要增加id在你的liquibase.xml文件。如果您对当前图表进行了更改,请按以下步骤操作。

<changeSet id="73" author="fcelik">
<comment>This change adds to customer_order table.</comment>
<addColumn tableName="customer_order">
<column name="owner_id" type="BIGINT">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>

您的文件必须是与 liquabase.xml 不匹配的值。您想要在创建文件之间执行什么操作(通常是跟踪增量路径。)。例如,我在customer_order中添加了一个新列表在这里。请注意<addColumn>当您使用该标签时。

关于Liquibase 校验和验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37408387/

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