public Change[] prepareDatabase(AddDefaultValueChange change) throws Exception {
CreateTableChange createTableChange = new CreateTableChange();
createTableChange.setCatalogName(change.getCatalogName());
createTableChange.setSchemaName(change.getSchemaName());
createTableChange.setTableName(change.getTableName());
createTableChange.addColumn(new ColumnConfig().setName("other_col").setType("int"));
String type = change.getColumnDataType();
if (type == null) {
if (change.getDefaultValueDate() != null) {
type = "datetime";
} else if (change.getDefaultValueBoolean() != null) {
type = "boolean";
} else if (change.getDefaultValueNumeric() != null) {
type = "decimal";
} else {
type = "varchar(255)";
}
}
createTableChange.addColumn(new ColumnConfig().setName(change.getColumnName()).setType(type));
return new Change[]{createTableChange};
}