Reputation: 4973
I have the following table (let's call it TBL), that I'm trying to remove a primary key from. Underlying DB is H2.
<createTable tableName="TBL">
<column name="ID" type="BIGINT">
<constraints primaryKey="true" primaryKeyName="TBL_PK"/>
</column>
...
Trying to use the following script in a later changeset, I run into the error below.
<dropPrimaryKey tableName="TBL" constraintName="TBL_PK" />
Error:
Caused by: org.h2.jdbc.JdbcSQLException: Index "PRIMARY_KEY_xx" belongs to a constraint; SQL statement:
ALTER TABLE TBL DROP PRIMARY KEY [90085-140]
Any idea what I am missing?
I know that there is dropIndex
, but I don't know how to target the PRIMARY_KEY_xx
(to stay generic for later stages).
Upvotes: 1
Views: 1411
Reputation: 4932
I guess that problem is with H2 db. When you create PK it creates some constraint(s).
Try to find it with query:
select * from information_schema.constraints where table_name='TBL' and column_list='ID'
Upvotes: 1