[英]Liquibase liquibase.exception.ValidationFailedException: Validation Failed:
我試圖將 int 列修改為 varchar ,但從這個開始它給出了很多錯誤。
@NotNull
@Column(nullable = false)
@Enumerated(value = EnumType.STRING)
private MerchantStatus status;
public MerchantStatus getStatus() {
return status;
}
public Merchant setStatus(MerchantStatus status) {
this.status = status;
return this;
}
這是域中的列。 它是枚舉。
這是枚舉
public enum MerchantStatus {
ACTIVE("merchant.status.active"),
PASSIVE("merchant.status.passive");
private String key;
MerchantStatus(String key) {
this.key = key;
}
public String getKey() {
return key;
}
}
這是 liquibase 配置
<column name="status" type="INT"/>
我試圖改變這里。 或者我在 20160616145216 里面加了這個
<modifyDataType
columnName="status"
newDataType="varchar(255)"
tableName="merchant"/>
但它沒有用。
2 更改集校驗和 |
類路徑:config/liquibase/changelog/20160616145216_create_merchant.xml::1466077959485-1::(生成)現在是:7:5fb40924426396399804bb2cb7f74852
|
類路徑:config/liquibase/changelog/20160720101800_load_data.xml::0000000000001-2::(生成)現在是:7:aa0084f69ca5301ef48cfb97beb41582
| | | liquibase.exception.ValidationFailedException:驗證失敗:f | 2 更改集校驗和 |
類路徑:config/liquibase/changelog/20160616145216_create_merchant.xml::1466077959485-1::(生成)現在是:7:5fb40924426396399804bb2cb7f74852
|
類路徑:config/liquibase/changelog/20160720101800_load_data.xml::0000000000001-2::(生成)現在是:7:aa0084f69ca5301ef48cfb97beb41582
| | 在 liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:215) | 在 liquibase.Liquibase.update(Liquibase.java:208) | 在 liquibase.Liquibase.update(Liquibase.java:192) | 在 liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:434) | 在 liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:391) | 在 net.infoowl.fraud.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:63) 1 | 在 net.infoowl.fraud.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:49) | 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) | 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) | 在 java.lang.Thread.run(Thread.java:745)
還
錯誤:枚舉類 [net.infoowl.fraud.domain.util.MerchantStatus] 的未知名稱值 [0]; 嵌套異常是 java.lang.IllegalArgumentException: Unknown name value [0] for enum class [net.infoowl.fraud.domain.util.MerchantStatus]
此外
也當我在這之后做差異
<
modifyDataType
columnName="status"
newDataType="varchar(255)"
tableName="merchant"/>
它仍然沒有轉換為 varchar
您似乎已經修改了Liquibase已經執行的liquibase變更集。 不要這樣做:還原到以前的版本,然后添加新的變更集。
然后添加另一個changeSet(或任務),將該列中的所有0轉換為“ ACTIVE”,並將該列中的所有1轉換為“ PASSIVE”。
我遇到了同樣的問題。
config/liquibase/changelog/20211227120229_added_entity_Product.xml::20211227120229-1-data::jhipster was: 8:d9bea6afc2902ce60cdfa54e82d248c4 but is now: 8:e353c8335afd112dfef95e3e95562f56
我正在使用 jHipster 創建實體(db 表)及其相關屏幕和其他文件。 jhipster 處理得很好。 我修改了現有表結構之一並在其中添加了新列。 從那以后我開始收到這個錯誤。 我沒有手動修改 liquibase xml 文件。 它是由 jhipster 腳本完成的。 對我有用的解決方案是使用以下命令在表 DATABASECHANGELOG 中手動修改 MD5SUM。
update DATABASECHANGELOG set MD5SUM = '8:e353c8335afd112dfef95e3e95562f56'
where MD5SUM = '8:d9bea6afc2902ce60cdfa54e82d248c4';
此更新后,它解決了我的問題,但是我最后添加的列不在表中。 所以我需要手動添加。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.