diffDatabaseToChangeLog recreate indexes every time


I have several issues w/ Liquibase + MySQL + Hibernate.

I am using liquibase version 2.0.1 in a maven project. I use mvn antrun:run to create the change log file. I first run it to an empty database and then run liquibase:update to update the database, when I rerun the mvn antrun:run, the log file contains changes (it shouldn’t), it creates indexes again and drop constraints and if I run the update mysql complains about duplicate indexes (as expected)

The second issue I have is about auto_increment ids, I have to add the addAutoIncrement manually to my changeSet, why the diff change log task not add that to the created changeSet?

Also some create statements are wrong, like:

  • having a column defined as varchar(204555), MySQL complains that you should use Text or Blob.
  • having a field with default value, the log creates it as “varchar default ‘MyValue’ (255)”, which is wrong it should be "varchar(255) default ‘MyValue’.
  • have a double field, the generated log defined it as double percision(19), have to make double percision to have mysql accepts it (found a post about this).
The really important thing from all those issues is the repeated indexes problem, it will be pain to delete all duplicate changes every time you have an update and you generate the log, especially when you have a large db, and you can easily delete a new change by mistake.