ColumnDefinitionChange extends ColumnChangeBase { public boolean isUniqueChanged(){ return Iterables.any(propertyChanges, PropertyChange.nameEquals(ColumnPropertyChange.UNIQUE)); } ColumnDefinitionChange(DbTable table, DbColumn oldColumn, DbColumn newColumn,List<ColumnPropertyChange> propertyChanges); @Override SchemaChangeType getChangeType(); @Override void toJson(JsonWriter writer); @Immutable List<ColumnPropertyChange> getPropertyChanges(); boolean isSizeChanged(); boolean isTypeChanged(); boolean isNullableChanged(); boolean isUniqueChanged(); boolean isDefaultChanged(); boolean isCommentChanged();  }
@Test @Contextual public void testColumnUniquePropertyChange() { DbColumnBuilder col = DbColumnBuilder.varchar("col1", 100); DbTableBuilder table = new DbTableBuilder("test_unique_change") .addColumn(col); db.cmdCreateTable(table.build()).execute(); col.setUnique(true); DbTable targetTable = db.getMetadata().tryGetTable(table.getTableName()); assertNotNull(targetTable); SchemaChanges changes = db.getComparator().compareTable(table.build(), targetTable); assertEquals(1, changes.size()); assertTrue(changes.get(0) instanceof ColumnDefinitionChange); ColumnDefinitionChange change = (ColumnDefinitionChange)changes.get(0); assertTrue(change.isUniqueChanged()); changes.applyChanges(); targetTable = db.getMetadata().tryGetTable(table.getTableName()); changes = db.getComparator().compareTable(table.build(), targetTable); assertNull(changes.firstOrNull(ColumnDefinitionChange.class)); db.cmdDropTable(table.getTableName()).execute(); }