like this, The ddl is applied every time the application starts, even if the table structure has not changed.
alter table sys_user modify column sex enum ('FEMALE','MALE')
After debugging and troubleshooting, I found that the real column size is inconsistent with the column size in the entity class, so every time I modify the table structure.
The enumeration column size returned by mysql driver is 6，hibernate the column size is calculated by the default value of the varchar type, 255,255 and 6 are not equal, so each time the alter.
In fact, I think enumeration types do not need to judge whether the size is consistent, and this problem will also occur in datetime and bigint, datetime I handled this problem through custom dialect. I also don’t know how mysql calculates the column size for enumeration and bigint types, because he read the data in the information_schema.column table.