I am using the liquibase XML DSL to modify primary/foreign keys on tables in a database. The target RDBMS systems are oracle and sql server. I want a precondition check in my changeset to check whether the column is nullable or not. If it does allow nulls, then I want to alter the column and make it not null. (Of course I will make sure the column has data before attempting to make it not null.) SQL Server appears to allow (or ignore) altering a column that is already not null to not null (and vice-versa in regards to a nullable column). Oracle, on the other hand, does not appear to allow this and generates an error.
If there’s no cleaner/better way to check whether a column is nullable or not (wouldn’t know constraint name so couldn’t use the constraint precondition), I’ll leverage the failOnError=“false” attribute.
Is there a better way in liquibase to check a column to determine whether it is nullable or not.
Thank you.