private static ChangeType findOldName(List<TableChange> changes, String oldName) { for (TableChange change : changes) { if (oldName.equals(change.getOldName())) { return change.getChangeType(); } } return null; }
private static String findNewName(List<TableChange> changes, String oldName) { for (TableChange change : changes) { if (oldName.equals(change.getOldName())) { return change.getChangeType() == ChangeType.DROP ? null : change.getNewName(); } } return oldName; }
private static void checkForeignKeyAlterColumns( List<TableChange> columnChanges, Collection<Column> columns, ForeignKey foreignKey, Table table) { for (Column column : columns) { for (TableChange change : columnChanges) { if (column.getName().equals(change.getOldName())) { throw new ForeignKeyPreventsAlterColumnException( column.getName(), table.getName(), foreignKey.getConstraintName().getTableName()); } } } }