Length restriction on index

Description

An index for a MySQL CLOB column cannot be created with Liquibase createIndex at the moment, since MySQL requires a length limit for this index, see http://dev.mysql.com/doc/refman/5.5/en/create-index.html

I don't know if other databases have similar requirements, but I think it would not break anything for anyone to introduce an optional length attribute for index definitions like so:

<createIndex tableName="foo" indexName="i_foo> <column name="myClobColumn" length="80"/> </createIndex>

For MySQL, this would be translated into

create index i_foo on foo (myClobColumn(80))

Environment

None

Activity

Show:

James Couball May 9, 2015 at 11:54 PM

As a workaround, you can use the modifySql to 'fix' the sql generated like so:

<createIndex tableName="foo" indexName="i_foo"> <column name="myClobColumn"/> </createIndex> <modifySql dbms="mysql"> <replace replace="myClobColumn" with="myClobColumn(80)"/> </modifySql>

when I use modifySql, I always put it and the command being modified in their own changeSet.

Details

Reporter

Affects versions

Priority

Created June 25, 2012 at 10:52 AM
Updated May 9, 2015 at 11:54 PM