Liquibase converts TIMESTAMP to DATETIME on MySQL
Description
Environment
Attachments
discovered while testing
Activity
Nathan Voxland May 23, 2013 at 1:18 PM
Liquibase uses "timestamp" to mean timestamp by default on mysql now. Probably more what people expect
Nathan Voxland September 13, 2011 at 5:46 AM
How to handle datatypes will be the focus of 2.1. The trouble is that for most databases TIMESTAMP means datetime so if you want cross-database changelogs you could argue that you want mysql to convert timestamp to datetime.

Sven Oppermann March 8, 2011 at 2:15 PM
After reading http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-type-conversions.html it states, that java.sql.Timestamp results in datetime AND timestamp. Due to the fact that there is no java.sql.type for DATETIME we decided if a developer uses java.sql.types.Timestamp DATETIME as result is correct. Does a developer really want TIMESTAMP he uses TIMESTAMP as type (without java.sql.types). So everything works as expected in 2.0.0 and my patch isnt correct.

Sven Oppermann March 4, 2011 at 2:44 PMEdited
run into the same problem. debuged it down in 2.0.0 and found the problem. attached the patch "mysql_timestamp_bug.patch"

J February 17, 2011 at 8:20 PM
example using liquibase 2.0 xsd and defaultValueComputed
I have column in a changeset defined so:
When I attempt to apply it to my MySQL database, I get database errors. It turns out that Liquibase is changing my "timestamp" into "datetime." This is in liquibase.database.AbstractDatabase#getColumnType(String columnType, Boolean autoIncrement). Since TIMESTAMP is a legitimate and desired column type for MySQL, liquibase.database.MySQLDatabase should override getColumnType(...) to allow TIMESTAMP. I have an extension that I am using locally for the time being that simply overrides the method so: