Liquibase diff 使用表名的错误大小写生成变更集

发布于 2024-08-18 12:41:21 字数 1731 浏览 2 评论 0原文

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

  • 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以使用正确的大小写,它就可以工作。

关于如何使其正常工作有什么建议吗?

问候

马蒂

I'm performing a diff on a remote mysql database using LiquiBase, and finding that the changeset that is generated uses the incorrect casing for table names (all lowercase). This subsequently causes the update to fail.

  • Liquibase v1.9.5
  • Database : MySQL
  • Local OS: Windows 7
  • Remote OS: Ubuntu

Am I doing something wrong, or is this a bug?

Here's my diff task:

<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>

This generates (amongst other entries):

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

Running the update against this changeset causes the following:

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

The actual table name is "Project". If I modify the changeEntry to use the correct casing, it works.

Any suggestions on how to get this working correctly?

Regards

Marty

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

思念绕指尖 2024-08-25 12:41:21

这似乎是一个错误。在某些地方,我们将表名小写,以便与不区分大小写的数据库正常工作,但这会导致区分大小写的数据库出现问题。

LiquiBase 2.1 计划对 diff 工具进行改进。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文