super(DropUniqueConstraintChange.class);
}
@Override
public Change[] prepareDatabase(DropUniqueConstraintChange change) throws Exception {
CreateTableChange createTableChange = new CreateTableChange();
createTableChange.setCatalogName(change.getCatalogName());
createTableChange.setSchemaName(change.getSchemaName());
createTableChange.setTableName(change.getTableName());
String uniqueColumns = change.getUniqueColumns();
if (uniqueColumns == null) {
uniqueColumns = "test_col";
}
for (String column : uniqueColumns.split(",")) {
createTableChange.addColumn(new ColumnConfig().setName(column.trim()).setType("int").setConstraints(new ConstraintsConfig().setNullable(false)));
}
createTableChange.addColumn(new ColumnConfig().setName("other_column").setType("int"));
AddUniqueConstraintChange addUniqueConstraintChange = new AddUniqueConstraintChange();
addUniqueConstraintChange.setCatalogName(change.getCatalogName());
addUniqueConstraintChange.setSchemaName(change.getSchemaName());
addUniqueConstraintChange.setTableName(change.getTableName());