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

Status

Reporter

Peter Pickerill

Components

Fix versions

Affects versions

Priority

Major
Configure