Liquibase diff generates changeset using wrong case on tablenames
Question
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
Solution
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.