2

我在 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)

任何想法如何解决这个问题?

提前致谢,

马蒂亚斯

4

2 回答 2

2
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <configuration>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.0.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.0-beta-9</version>
        </plugin>
        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-plugin</artifactId>
            <version>1.9.5.0</version>
            <configuration>
                <propertyFile>${liquibase.propertyFile}</propertyFile>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <version>9.0-801.jdbc4</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
于 2011-02-16T09:09:02.403 回答
0

您的 postgres 数据库中可能有多个模式。要解决您的问题,请将您的所有数据移动到公共架构中。

于 2011-09-09T13:22:26.373 回答