if ((change instanceof ColumnDataTypeChange) ||
(change instanceof ColumnSizeChange))
{
Column column = ((ColumnChange)change).getChangedColumn();
Table table = ((ColumnChange)change).getChangedTable();
if (column.isPrimaryKey() && !removedPKs.contains(table))
{
Column[] pk = table.getPrimaryKeyColumns();
additionalChanges.add(new RemovePrimaryKeyChange(table, pk));
additionalChanges.add(new AddPrimaryKeyChange(table, pk));
removedPKs.add(table);
}
for (int idx = 0; idx < table.getIndexCount(); idx++)
{
Index index = table.getIndex(idx);
if (index.hasColumn(column) && !removedIndexes.contains(index))
{
additionalChanges.add(new RemoveIndexChange(table, index));
additionalChanges.add(new AddIndexChange(table, index));
removedIndexes.add(index);
}
}
for (int tableIdx = 0; tableIdx < currentModel.getTableCount(); tableIdx++)
{
Table curTable = currentModel.getTable(tableIdx);
for (int fkIdx = 0; fkIdx < curTable.getForeignKeyCount(); fkIdx++)
{
ForeignKey curFk = curTable.getForeignKey(fkIdx);
if ((curFk.hasLocalColumn(column) || curFk.hasForeignColumn(column)) &&
!removedForeignKeys.contains(curFk))
{
additionalChanges.add(new RemoveForeignKeyChange(curTable, curFk));