Enum column types are not appropriately represented in the change log created by generateChangeLog

Description

TO REPRODUCE:

  1. Create a database table in MySQL that contains an enum column (or use

  1. to create)

  2. Use generateChangeLog to capture the table

  3. Delete the table

  4. Run 'update' with the change log generated in Step 2

RESULTS:
The 'update' fails. Error details can be found in

If you look at

there are 2 problems that keep the changeset from running successfully:

  1. The type attribute contains size information instead of enum values

    • BAD: type="ENUM(5)"

    • GOOD: type="ENUM('one','two','three')"

  2. The defaultValue attribute is not appropriately quoted

    • BAD: defaultValue="one"

    • GOOD: defaultValue="'one'"

If you manually update the xml to correct these 2 issues (example:

) it can be used with Liquibase to create the table.

NOTE: Even with the manually updated file, the enum isn't created appropriately. Only the first two possible entries specified by type="ENUM('one','two','three')" are included in the enum in the database.

So while you are going for this:

  • enum('one','two','three','four')

You end up with this:

  • enum('one','two')

Environment

Windows 7 w/ MySQL 5.5
CentOS 5 w/ MySQL 5

Activity

Show:
Nathan Voxland
March 3, 2013, 6:26 AM

Enum support is currently not in liquibase directly. Possibly in the liquibase-mysql extension

Peter Pickerill
March 4, 2013, 3:50 PM

Is there a mysql extension under development currently or is it planned? I can't find it in the available code base, but I may be overlooking it.

Nathan Voxland
March 5, 2013, 5:25 AM

I thought there was one already, but apparently it's just planned....

I'll probably try to create it during the 3.0 RC process to prove out the new diff/snapshot extensions

Nathan Voxland
December 12, 2013, 8:06 PM

Fixed

Fixed

Reporter

Peter Pickerill

Components

Fix versions

Affects versions

Priority

Major