【问题标题】:Liquibase maven plugin: cannot find the databasechangelog table, PostgreSQLLiquibase maven插件:找不到databasechangelog表,PostgreSQL
【发布时间】:2020-10-12 13:31:58
【问题描述】:

我正在使用 liquibase maven 插件(版本 3.10.0)并且我正在尝试应用现有的迁移。在应用迁移之前,我创建了数据库,使用简单的 sql create database test

之后,我执行下面的maven命令

>mvn liquibase:update -Dliquibase.url=jdbc:postgresql://localhost:5432/test?currentSchema=public -Dliquibase.username=postgres -Dliquibase.password=postgres -Dliquibase.context=dev

但是,完成后,我收到以下错误

[ERROR] Could not release lock liquibase.exception.LockException: liquibase.exception.DatabaseException: Error executing SQL UPDATE databasechangeloglock SET LOCKED = FALSE, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1: ERROR: relation "databasechangeloglock" does not exist

Error executing SQL SELECT MAX(ORDEREXECUTED) FROM databasechangelog: ERROR: relation "databasechangelog" does not exist

我的 liquibase maven 插件配置如下

    <build>
        <plugins>
            <plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>${liquibase-maven-plugin.version}</version>
                <configuration>
                    <databaseChangeLogLockTableName>databasechangeloglock</databaseChangeLogLockTableName>
                    <databaseChangeLogTableName>databasechangelog</databaseChangeLogTableName>
                    <changelogSchemaName>public</changelogSchemaName>
                    <defaultSchemaName>public</defaultSchemaName>
                    <driver>org.postgresql.Driver</driver>
                    <changeLogFile>${basedir}/src/main/resources/liquibase/changelog-master.xml</changeLogFile>
                </configuration>
            </plugin>
        </plugins>
    </build>

我把这个配置放到了专用的 maven 模块中。

【问题讨论】:

    标签: postgresql maven liquibase


    【解决方案1】:

    我遇到了同样的问题,原来是postgresql db jar版本问题,尝试用最新的postgresql驱动jar更新你的pom

    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>42.2.11</version>
    </dependency>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多