processChange(currentModel, desiredModel, addColumnChange);
changeIt.remove();
}
ListOrderedSet changedColumns = new ListOrderedSet();
// we don't have to care about the order because the comparator will have ensured
// that a add primary key change comes after all necessary columns are present
for (Iterator changeIt = changes.iterator(); changeIt.hasNext();)
{
TableChange change = (TableChange)changeIt.next();
if (change instanceof RemoveColumnChange)
{
processChange(currentModel, desiredModel, (RemoveColumnChange)change);
changeIt.remove();
}
else if (change instanceof AddPrimaryKeyChange)
{
processChange(currentModel, desiredModel, (AddPrimaryKeyChange)change);
changeIt.remove();
}
else if (change instanceof PrimaryKeyChange)
{
processChange(currentModel, desiredModel, (PrimaryKeyChange)change);
changeIt.remove();
}
else if (change instanceof RemovePrimaryKeyChange)
{
processChange(currentModel, desiredModel, (RemovePrimaryKeyChange)change);
changeIt.remove();
}
else if (change instanceof ColumnChange)
{
// we gather all changed columns because we can use the ALTER TABLE MODIFY COLUMN
// statement for them
changedColumns.add(((ColumnChange)change).getChangedColumn());
changeIt.remove();
}
}
for (Iterator columnIt = changedColumns.iterator(); columnIt.hasNext();)
{
Column sourceColumn = (Column)columnIt.next();
Column targetColumn = targetTable.findColumn(sourceColumn.getName(), getPlatform().isDelimitedIdentifierModeOn());
processColumnChange(sourceTable, targetTable, sourceColumn, targetColumn);