我在 postgresql-db 上运行 maven 的 liquibase-plugin 时遇到问题。尝试从命令行运行 liquibase:update 时,我收到错误消息
[ERROR] Failed to execute goal org.liquibase:liquibase-plugin:1.9.5.0:update (de
fault-cli) on project backend-persistence: Error setting up or running Liquibase
: liquibase.exception.JDBCException: Error executing SQL CREATE TABLE databasech
angeloglock (ID INT NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED TIMESTAMP WIT
H TIME ZONE, LOCKEDBY VARCHAR(255), CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY
KEY (ID)): FEHLER: Relation ╗databasechangeloglock½ existiert bereits -> [Help 1
]
简单地删除 db-table 没有帮助,看起来 liquibase 正在创建它两次,如日志文件所示:
...
CREATE TABLE databasechangeloglock (ID INT NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED TIMESTAMP WITH TIME ZONE, LOCKEDBY VARCHAR(255), CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID))
COMMIT
BEGIN
INSERT INTO databasechangeloglock (ID, LOCKED) VALUES (1, false)
COMMIT
BEGIN
LECT NULL AS TABLE_CAT, n.nspname AS TABLE_SCHEM, c.relname AS TABLE_NAME, CASE n.nspname
....
CREATE TABLE databasechangeloglock (ID INT NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED TIMESTAMP WITH TIME ZONE, LOCKEDBY VARCHAR(255), CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID))
FEHLER: Relation »databasechangeloglock« existiert bereits (already exists)
任何想法如何解决这个问题?
提前致谢,
马蒂亚斯