Quarkus liquibase postgres 更新分配大小序列

问题描述 投票:0回答:1

我尝试使用 quarkus postgres 和 liquibase 更新实体的值增量(allocationSize),问题是这些值不一致的抛出错误

我用来更新序列的脚本

alter sequence ID_SEQ increment by 100;

实体

@Entity
@Table(name = "ENTITY")
@SequenceGenerator(name = "ID_SEQ", sequenceName = "ID_SEQ", allocationSize = 100)
public class ENTITY extends PanacheEntityBase

我收到错误

Schema-validation: sequence [ID_SEQ] defined inconsistent increment-size; found [1] but expecting [100]
postgresql quarkus liquibase
1个回答
0
投票

您必须使用

sequenceGenerator
而不是实体来注释字段(例如:id) 或上课。

@Entity
@Table(name = "ENTITY")
public class ENTITY extends PanacheEntityBase{

@Id
@SequenceGenerator(name = "ID_SEQ", sequenceName = "ID_SEQ", allocationSize =100)
public Integer id;

}
© www.soinside.com 2019 - 2024. All rights reserved.