We use liquibase to manage one of our MySQL databases' updates, rollbacks, etc.
One small curiosity I've come across is the process of setting values to null in the course of updates or rollbacks. Example:
<rollback>
<update tableName="boats">
<column name="engine" value="null" />
<column name="oars" value="2" />
At first I was a bit worried that "null" would literally insert the string "null", but it turns out that liquibase seems to have some smarts that actually inserts a null value.
I was wondering if this was the recommended way of doing this, or whether there is a platform-agnostic way of saying 'nullValue' explicitly within Liquibase?
Just omit the value
attribute on <column>
:
<rollback>
<update tableName="boats">
<column name="engine" type="varchar(255)"/>
</update>
</rollback>
Reference: Update
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With