warning of losing primary key/autoincrement for mysql

Hi everyone,

I got the following warning.

WARNING 11-1-26 afternoon 8:52:liquibase: modifyDataType will lose primary key/autoincrement/not null settings for mysql.  Use and re-specify all configuration if this is the case

Does this mean if i use modifyDataType statement on a primary key/autoincrement, it will lose autoincrement and not null settings? Could you explain it?

Cheers,
Cheng Wei

The trouble is that if you alter a primary key or not null table without re-specifying that it is not null or primary key it will not keep that information.  It is a limitation/feature of mysql’s SQL dialect.  Since liquibase knows nothing about the underlying column metadata, we cannot know if the modifyDataType change will run into that case for you.  To let you know, we output that warning for mysql if it looks likes you may possibly be hitting that scenario.

If you are altering a column that is not null or a primary key, you will need to use and include a standard mysql alter table alter column statemnt.  If the column is nullable, you can safely ignore the warning.

Nathan

Sorry to raise up an old thread, but is it possible to suppress this warning if we know that it does not apply?

No, but I created http://liquibase.jira.com/browse/CORE-955 to track the feature request.


Nathan