@Override
public Change[] fixChanged(DatabaseObject changedObject, ObjectDifferences differences, DiffOutputControl control, Database referenceDatabase, Database comparisonDatabase, ChangeGeneratorChain chain) {
Index index = (Index) changedObject;
DropIndexChange dropIndexChange = new DropIndexChange();
dropIndexChange.setTableName(index.getTable().getName());
dropIndexChange.setIndexName(index.getName());
CreateIndexChange addIndexChange = new CreateIndexChange();
addIndexChange.setTableName(index.getTable().getName());
List<AddColumnConfig> columns = new ArrayList<AddColumnConfig>();
for (Column col : index.getColumns()) {
columns.add(new AddColumnConfig(col));
}
addIndexChange.setColumns(columns);
addIndexChange.setIndexName(index.getName());
if (control.getIncludeCatalog()) {
dropIndexChange.setCatalogName(index.getSchema().getCatalogName());
addIndexChange.setCatalogName(index.getSchema().getCatalogName());
}
if (control.getIncludeSchema()) {
dropIndexChange.setSchemaName(index.getSchema().getName());
addIndexChange.setSchemaName(index.getSchema().getName());
}
Difference columnsDifference = differences.getDifference("columns");