Liquibase diff 使用表名的错误大小写生成变更集
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎是一个错误。在某些地方,我们将表名小写,以便与不区分大小写的数据库正常工作,但这会导致区分大小写的数据库出现问题。
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.