使用 Maven 和 postgres-db 运行 liquibase 时出现问题
我在 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)
任何想法如何解决这个问题?
预先感谢,
马蒂亚斯
I have a problem running maven's liquibase-plugin on a postgresql-db.
When trying to run liquibase:update from the command-line, I get the error message
[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
]
simply dropping the db-table does not help, it looks like liquibase is creating it twice, as the logfile suggests:
...
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)
Any ideas how to solve this problem?
Thanks in advance,
Matthias
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的 postgres 数据库中可能有多个架构。要解决您的问题,请将所有数据移至公共架构中。
You're probably have multiple schema in your postgres database. To solve your problem, move all your data in the public schema.