0

I've been running Liquibase for both mySQL (for the real stuff) and HSQLDB (for testing). I recently had to update our Hibernate version, which required me to update our HSQLDB version to 2.x.x - I went with the latest. Now I have at least one changeset that was running fine before, but now gives me:

Error executing SQL ALTER TABLE app_user DROP COLUMN name: column is referenced in: PUBLIC.SYS_CT_10302 in statement [ALTER TABLE app_user DROP COLUMN name]

The column "name" does have a unique constraint on it (along with another column) at the time it is being dropped, so I suspect that is the problem. However, the unique constraint doesn't have a name, so I haven't had any success dropping it first, either.

4

1 回答 1

2

您可以通过查询 INFORMATION_SCHEMA 找到 UNIQUE 约束的名称:

SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE COLUMN_NAME = 'NAME' AND TABLE_NAME = 'APP_USER'

ALTER TABLE APP_USER DROP CONSTRAINT ...

或者,您可以将该列连同使用它的任何约束一起删除:

ALTER TABLE APP_USER DROP COLUMN NAME CASCADE
于 2012-04-09T11:50:45.983 回答