Skip to content

Instantly share code, notes, and snippets.

@cherniag
Created February 29, 2016 16:05
Show Gist options
  • Save cherniag/f7112ce712d6fca70234 to your computer and use it in GitHub Desktop.
Save cherniag/f7112ce712d6fca70234 to your computer and use it in GitHub Desktop.
liquibase mysql add index on text field
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
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment