IN Liqubiase, how do I change the "On UPDATE" value of a column?

784 Views Asked by At

I’m using Liquibase 3.3 with MySql 5.5.37. I had a column with

+--------------+-------------+------+-----+---------+-----------------------------+
| Field        | Type        | Null | Key | Default | Extra                       |
+--------------+-------------+------+-----+---------+-----------------------------+
| CLOSED_DATE  | timestamp   | NO   |     | NULL    | on update CURRENT_TIMESTAMP |

What is the right way in Liquibase to remove the “on update CURRENT_TIMESTAMP” clause and just make it NULL? I tried

    <dropDefaultValue columnDataType="TIMESTAMP"
        columnName="CLOSED_DATE"
        tableName="sb_group"/>

but that didn’t do anything.

1

There are 1 best solutions below

0
On

That sounds very platform-specific, so you probably need to use a custom <sql> tag in your changes:

<sql dbms="mysql">
  custom SQL goes here
</sql>

But you'll have to replace "custom SQL goes here" with the appropriate MySQL syntax to remove the "on update" clause.