MySQL GenerateChangeLog

Hello,

We are trying to use liquibase for our database. I used the generateChangeLog command to create the current snapshot of our database. I ran into a problem where all the default field is created as DATETIME instead of TIMESTAMP.

Since they all have a defaultValue=“CURRENT_TIMESTAMP”, I am running into problems creating the database.

Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Invalid default value for ‘modified_at’

It doesn’t work even if I modify the TYPE to “TIMESTAMP”. The “TIMESTAMP” type still map back to “DATETIME”. I had modify it to to get it to work. I have 100 entry that need to change. Does anyone know if I am doing anything wrong?

Thanks,

Michael

I found this problem, too (liquibase-1.9.5).

Is there any way to generate a MySQL TIMESTAMP data type as a column type?  It seems that liquibase always maps TIMESTAMP to DATETIME, which is a different data type under MySQL.

Thanks,
Michael.

The timestamp handling is kind of strange, since mysql’s timestamp type goes against what most databases call tiemstamp, and so we need choose between cross-database support and mysql-specific support. 

For now, you’ll have to use the tag to get mysql’s timestamp type.

Nathan

v2 rc6 seems to work correctly with timestamp