示例#1
0
 private static ChangeType findOldName(List<TableChange> changes, String oldName) {
   for (TableChange change : changes) {
     if (oldName.equals(change.getOldName())) {
       return change.getChangeType();
     }
   }
   return null;
 }
示例#2
0
 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;
 }
示例#3
0
 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());
       }
     }
   }
 }