liquibase-plugin错误 - 迁移失败

时间:2017-09-27 11:05:42

标签: java spring liquibase

启动Java应用程序时遇到问题

liqibase更新错误:

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.1:update (default-cli) on project api-manager: Error setting up or running Liquibase: Migration failed for change set db/changelog/1.0/1.0-init-tables.xml::1.0-init-tables::api-manager:
[ERROR] Reason: liquibase.exception.DatabaseException: ERROR: relation "service" does not exist [Failed SQL ..... so on ... so on

pom片段

    <dependency>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-core</artifactId>
        <scope>runtime</scope>
    </dependency>

        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>${liquibase-maven-plugin.version}</version>
            <configuration>
                <changeLogFile>db/changelog/db.changelog-master.xml</changeLogFile>
                <driver>${manager.db.driver}</driver>
                <url>${manager.db.url}</url>
                <username>${manager.db.user}</username>
                <password>${manager.db.password}</password>
                <verbose>false</verbose>
                <logging>info</logging>
                <contexts>${manager.db.contexts}</contexts>
                <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
            </configuration>
        </plugin>

资源/ db / changelog / db.changelog-master.xml中的db.changelog-master.xml:

<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

    <include file="db/changelog/1.0/1.0-init-tables.xml"/>

</databaseChangeLog>

资源/ db / changelog / 1.0 / 1.0-init-tables.xml中的1.0-init-tables.xml:

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

    <changeSet id="1.0-init-tables" author="api-manager">
          HERE ARE MINE <CREATE TABLES>
    </changeSet>
</databaseChangeLog>

如果需要sql错误日志,请告诉我,然后我将编辑此帖子。

1 个答案:

答案 0 :(得分:0)

如果有人发生类似错误,请检查您的桌子是否小写 - 是的Postgres不喜欢UpperCases ... 这些变化解决了我的问题