Seeker105
Seeker105

Reputation: 1

I'm looking for detailed information on how to create a custom LiquiBase ChangeType for DEFAULT ON NULL

The Oracle database has an option for DEFAULT ON NULL, but LiquiBase does not have a changetype for that. LiquiBase allows you to specify a default value for a column, but that is only used if that value is omitted from the insert statement. If you persist a Hibernate entity that has a property set to null it generates an insert statement that explicitly sets the field to null and the default is not invoked. DEFAULT ON NULL values are used any time a null is persisted into that column, even when it is explicitly set by the insert statement.

You can set an Oracle column to DEFAULT ON NULL via SQL as in ALTER TABLE tableName MODIFY columnName DEFAULT ON NULL 'someString';

But I need to make this work with LiquiBase. So I'm looking at classes that extend AbstractChange and implement SqlStatement, and at the JavaDocs for CustomSqlChange and related classes. But the javadocs mostly just list method names and parameter/return types. I'm looking for information and examples on how to register the change type and make it correctly execute the SQL we need.

Upvotes: 0

Views: 27

Answers (0)

Related Questions