I have the issue that a field called updated_at which the user freely selects a date to be stored, that if the user send 2021-08-11T21:59:59.999Z
, this will be rounded to 2021-08-11 22:00:00.0
automatically, so the field is looking like this
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "updated_at")
private Date updatedAt;
I read that changing the timestamp
to timestamp(3)
will solve the rounding problem, so I wrote a Liquibase script like this changeset
<changeSet id="10" author="autho2">
<modifyDataType
columnName="updated_at"
newDataType="timestamp(3)"
tableName="user_data"/>
</changeSet>
However, I get error:
liquibase.exception.DatabaseException:
Invalid default value for 'updated_at' [Failed SQL:
(1067) ALTER TABLE user_data MODIFY updated_at timestamp(3)]
What am I doing wrong or am i converting date to instance wrongly?