Difference difference = differences.getDifference("defaultValue");
if (difference != null) {
Object value = difference.getReferenceValue();
LiquibaseDataType columnDataType = DataTypeFactory.getInstance().from(column.getType(), comparisonDatabase);
if (value == null) {
DropDefaultValueChange change = new DropDefaultValueChange();
if (control.getIncludeCatalog()) {
change.setCatalogName(column.getRelation().getSchema().getCatalog().getName());
}
if (control.getIncludeSchema()) {
change.setSchemaName(column.getRelation().getSchema().getName());
}
change.setTableName(column.getRelation().getName());
change.setColumnName(column.getName());
change.setColumnDataType(columnDataType.toString());
changes.add(change);
} else {
AddDefaultValueChange change = new AddDefaultValueChange();
if (control.getIncludeCatalog()) {
change.setCatalogName(column.getRelation().getSchema().getCatalog().getName());
}
if (control.getIncludeSchema()) {
change.setSchemaName(column.getRelation().getSchema().getName());
}
change.setTableName(column.getRelation().getName());
change.setColumnName(column.getName());
change.setColumnDataType(columnDataType.toString());
if (value instanceof Boolean) {
change.setDefaultValueBoolean((Boolean) value);
} else if (value instanceof Date) {
change.setDefaultValueDate(new ISODateFormat().format(((Date) value)));