MySQL types don't match when using diffChangeLog
Description
Environment
MySQL 5.7.19
Activity
Show:

Oleg Dulin February 26, 2018 at 11:00 PM
One more note. There is another flaw.
In ChangedColumnChangeGenerator:
change.setNewDataType(DataTypeFactory.getInstance().from(referenceType, comparisonDatabase).toString());
The toString on ClobType returns "clob" . It needs to return the correct type that the database reported.

Oleg Dulin February 26, 2018 at 10:55 PM
I think the issue is in the DataTypeFactory. ClobType gets registered as TEXT. During the generation of the changelog, it gets serialized as "clob"
I may contribute a fix as a pull request if noone gets to it.
Consider the following:
We update the table as follows (from VARCHAR(256) to TEXT):
{{ALTER TABLE Team
CHANGE COLUMN Context_Country_Code Context_Country_Code TEXT NULL DEFAULT NULL ;}}
Using diffChangeLog this produces the following:
{{<changeSet author="dulino (generated)" id="1519676305101-72">
<modifyDataType columnName="Context_Country_Code" newDataType="clob" tableName="Team"/>
<dropNotNullConstraint columnDataType="clob" columnName="Context_Country_Code" tableName="Team"/>
</changeSet>}}
When this diffChangeLog is applied, the type becomes LONGTEXT.
Is it a bug or are we missing something?