小编bel*_*kor的帖子

liquibase不会生成表DATABASECHANGELOG

我是liquibase的新手,我想在生产中的数据库上使用它。这是一个小型应用程序,但我不想使用手工创建架构,而是使用更专业的工具,例如liquibase。

我计划要做的是在生产中的当前模式与为新应用程序准备的新模式之间建立一个变更日志。我已经看了很多教程,但是仍然缺少一些东西。输出的changelog.xml始终导入所有模式,并且与现有模式没有区别。我看到liquibase必须创建表DATABASECHANGELOG,但是在我的计算机上看不到它们。

我做了什么 :

  • 生产中当前数据库的转储并在​​开发计算机上导入
  • 从核心项目添加了liquibase.properties并启动了以下命令:mvn clean resources:resources liquibase:generateChangeLog
  • 这将生成具有所有模式的master.xml,但未在DB中创建表DATABASECHANGELOG(在注释outputChangeLogFile时创建了表DATABASECHANGELOGLOCK,并且LOCKED值为0)
  • http://www.liquibase.org/databases.html手动创建了DATABASECHANGELOG
  • 重新运行命令mvn liquibase:generateChangeLog。依然没有

pom.xml:

<dependencies>
    ...
    <dependency>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-core</artifactId>
        <version>3.5.3</version>
    </dependency>
    <dependency>
        <groupId>org.yaml</groupId>
        <artifactId>snakeyaml</artifactId>
        <version>1.17</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.6</version>
    </dependency>
</dependencies>

 <!-- edited build after 1st comment. Still got the problem -->
<build>
    <plugins>
        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>${liquibase.version}</version>
            <configuration>
                <promptOnNonLocalDatabase>true</promptOnNonLocalDatabase>
                <changeLogFile>${project.build.directory}/classes/changelog/db.changelog-master.xml</changeLogFile>
                <propertyFile>src/main/resources/liquibase.properties</propertyFile>
            </configuration>
        </plugin>
    </plugins>
</build>

<!--- old section build, left for history purpose --->
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>${liquibase.version}</version>
                <configuration>
                    <promptOnNonLocalDatabase>true</promptOnNonLocalDatabase>
                    <changeLogFile>${project.build.directory}/classes/changelog/db.changelog-master.xml</changeLogFile>
                    <propertyFile>src/main/resources/liquibase.properties</propertyFile>
                </configuration> …
Run Code Online (Sandbox Code Playgroud)

java liquibase maven

6
推荐指数
1
解决办法
3954
查看次数

标签 统计

java ×1

liquibase ×1

maven ×1