java.util.Date cannot be cast to java.sql.Timestamp when trying to import generated changeset

Viewed 1041

I generated a list of baseline changesets in Liquibase and I'm trying to import it. However it's spitting out the following error when it tries to create a datetime field that has a default value:

Unexpected error running Liquibase: java.util.Date cannot be cast to java.sql.Timestamp

The column definition it's failing on is as follows:

- column:
    constraints:
    nullable: false
    defaultValueDate: 0000-00-00T00:00:01
    name: created
    type: datetime(6)

How can I fix this so it doesn't fail?

Update: I tried removing the default date value from the above column and my liquibase update command was able to move past it successfully. However, it then failed when trying to insert the first date value into a table with a datetime field, so it seems like the issue is with manipulating dates in general.

1 Answers

I found the solution. As it turns out, the fix was to simply add quotes around the datetime values that were causing the issue.

Related