1

我正在使用 LiquiBase 在远程 mysql 数据库上执行差异,并发现生成的变更集使用了不正确的表名大小写(全部小写)。这随后会导致更新失败。

  • Liquibase v1.9.5
  • 数据库:MySQL
  • 本地操作系统:Windows 7
  • 远程操作系统:Ubuntu

我做错了什么,还是这是一个错误?

这是我的差异任务:

<target name="diff-database" depends="prepare">
    <echo message="Diff ${database.url} to base ${production.database.url}" />
    <diffDatabaseToChangeLog driver="${database.driver}" 
        url="${production.database.url}" 
        username="${production.database.username}" 
        password="${production.database.password}" 

        baseUrl="${database.url}" 
        baseUsername="${database.username}" 
        basePassword="${database.password}" 
        outputFile="${changeLogFile}" classpathref="liquibase-path">
    </diffDatabaseToChangeLog>
</target>

这会生成(在其他条目中):

<changeSet author="Marty (generated)" id="1264010991558-2">
    <addColumn tableName="project">
        <column name="earliestUpdatedRevision" type="BIGINT"/>
    </addColumn>
</changeSet>    

针对此变更集运行更新会导致以下情况:

liquibase.exception.MigrationFailedException: Migration failed for change set changelogs/mysql/complete/root.changelog.xml::1264010991558-2::Marty (generated):
     Reason: liquibase.exception.JDBCException: Error executing SQL ALTER TABLE `project` ADD `earliestUpdatedRevision` BIGINT:
          Caused By: Error executing SQL ALTER TABLE `project` ADD `earliestUpdatedRevision` BIGINT:
          Caused By: Table 'xxx.project' doesn't exist

实际的表名是“Project”。如果我修改 changeEntry 以使用正确的大小写,它就可以工作。

有关如何使其正常工作的任何建议?

问候

马蒂

4

1 回答 1

3

It appears to be a bug. There are places that we lower case table names to work correctly with case insensitive databases, but then it causes problems with case sensitive databases.

Improvements to the diff tool are scheduled for LiquiBase 2.1.

于 2010-01-20T22:56:10.237 回答