Liquibase 索引 "PRIMARY_KEY_xx" 属于一个约束

Liquibase Index "PRIMARY_KEY_xx" belongs to a constraint

我有以下 table(我们称之为 TBL),我正在尝试从中删除主键。底层数据库是 H2。

<createTable tableName="TBL">
        <column name="ID" type="BIGINT">
            <constraints primaryKey="true" primaryKeyName="TBL_PK"/>
        </column>
        ...

尝试在以后的变更集中使用以下脚本,我 运行 进入以下错误。

<dropPrimaryKey tableName="TBL" constraintName="TBL_PK" />

错误:

Caused by: org.h2.jdbc.JdbcSQLException: Index "PRIMARY_KEY_xx" belongs to a constraint; SQL statement:
ALTER TABLE TBL DROP PRIMARY KEY [90085-140]

知道我错过了什么吗?


我知道有 dropIndex,但我不知道如何定位 PRIMARY_KEY_xx(以便在以后的阶段保持通用)。

我想问题出在 H2 数据库上。当您创建 PK 时,它会创建一些约束。 尝试通过查询找到它:
select * from information_schema.constraints where table_name='TBL' and column_list='ID'