Revision of my answer. Liquibase supports adding a non-null constraint as follows:
<changeSet author="me" id="example-001"> <addNotNullConstraint tableName="mytable" columnName="mycol" columnDataType="VARCHAR(10)" defaultNullValue="NULL"/> </changeSet>
This automatically processes the nullable columns, in my example filling them with the text string "NULL".
I do not think this set of changes requires a precondition. In the worst case scenario, you reapply the existing column constraint. Liquibase tracks all changes and ensures that they are not retried.
source share