Bug #11100 Add transformation vrom VARCHAR < 65536 to TEXT
Submitted: 4 Jun 2005 17:48 Modified: 11 Feb 2009 13:15
Reporter: Peter Fassev Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Migration Toolkit Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[4 Jun 2005 17:48] Peter Fassev
Description:
Hi,

currently, there is transformation only to MEDIUMTEXT for VARCHARS with length > 255. Please add a transformation to TEXT, when the length is < 65536.

Thanx
Peter

How to repeat:
See the Mehtod migrateColumnToMysql within MigrationOracle or MigrationMssql Class.

Suggested fix:
Rewrite the text convertion in:
			// text types
			if (sourceColumn.getLength() < 256) {
				// normal varchar up to 255 chars
				targetColumn.setDatatypeName("VARCHAR");
			} else if (sourceColumn.getLength() < 65536) {
				// small text up to 65535
				targetColumn.setDatatypeName("TEXT");
			} else if (sourceColumn.getLength() < 16777215) {
				// medium text up to 16777215
				targetColumn.setDatatypeName("MEDIUMTEXT");
			} else {
				// long text
				targetColumn.setDatatypeName("LONGTEXT");
			}
[11 Feb 2009 13:15] Susanne Ebrecht
Many thanks for pointing this out.

VARCHAR(254) => VARACHAR(254)
VARCHAR(4000) => Hint that you should change manually => TEXT => TEXT
VARCHAR(65500) => Hint that you should change manually => TEXT => MEDIUMTEXT

Consider here that 65500 is numbers of characters and not bytes. Consider that utf8 could have up to 3 bytes per character.

According to documentation:
http://dev.mysql.com/doc/refman/5.1/en/storage-requirements.html

Text is given there in Bytes. 65000 characters could be 3 times more then 65500 so convertion to Mediumtext is correct.