use of liquibase.diff.ObjectDifferences in project liquibase by liquibase.
the class IndexComparator method findDifferences.
@Override
public ObjectDifferences findDifferences(DatabaseObject databaseObject1, DatabaseObject databaseObject2, Database accordingTo, CompareControl compareControl, DatabaseObjectComparatorChain chain, Set<String> exclude) {
exclude.add("name");
exclude.add("columns");
ObjectDifferences differences = chain.findDifferences(databaseObject1, databaseObject2, accordingTo, compareControl, exclude);
differences.compare("columns", databaseObject1, databaseObject2, new ObjectDifferences.CompareFunction() {
@Override
public boolean areEqual(Object referenceValue, Object compareToValue) {
List<Column> referenceList = (List) referenceValue;
List<Column> compareList = (List) compareToValue;
if (referenceList.size() != compareList.size()) {
return false;
}
for (int i = 0; i < referenceList.size(); i++) {
if (!StringUtils.trimToEmpty((referenceList.get(i)).getName()).equalsIgnoreCase(StringUtils.trimToEmpty(compareList.get(i).getName()))) {
return false;
}
}
return true;
}
});
return differences;
}
use of liquibase.diff.ObjectDifferences in project liquibase by liquibase.
the class SchemaComparator method findDifferences.
@Override
public ObjectDifferences findDifferences(DatabaseObject databaseObject1, DatabaseObject databaseObject2, Database accordingTo, CompareControl compareControl, DatabaseObjectComparatorChain chain, Set<String> exclude) {
ObjectDifferences differences = new ObjectDifferences(compareControl);
differences.compare("name", databaseObject1, databaseObject2, new ObjectDifferences.DatabaseObjectNameCompareFunction(Schema.class, accordingTo));
return differences;
}
use of liquibase.diff.ObjectDifferences in project liquibase by liquibase.
the class TableComparator method findDifferences.
@Override
public ObjectDifferences findDifferences(DatabaseObject databaseObject1, DatabaseObject databaseObject2, Database accordingTo, CompareControl compareControl, DatabaseObjectComparatorChain chain, Set<String> exclude) {
exclude.add("indexes");
exclude.add("name");
exclude.add("outgoingForeignKeys");
exclude.add("uniqueConstraints");
exclude.add("primaryKey");
exclude.add("columns");
exclude.add("schema");
ObjectDifferences differences = chain.findDifferences(databaseObject1, databaseObject2, accordingTo, compareControl, exclude);
differences.compare("name", databaseObject1, databaseObject2, new ObjectDifferences.DatabaseObjectNameCompareFunction(Table.class, accordingTo));
return differences;
}
use of liquibase.diff.ObjectDifferences in project liquibase by liquibase.
the class UniqueConstraintComparator method findDifferences.
@Override
public ObjectDifferences findDifferences(DatabaseObject databaseObject1, DatabaseObject databaseObject2, Database accordingTo, CompareControl compareControl, DatabaseObjectComparatorChain chain, Set<String> exclude) {
exclude.add("name");
exclude.add("columns");
exclude.add("backingIndex");
ObjectDifferences differences = chain.findDifferences(databaseObject1, databaseObject2, accordingTo, compareControl, exclude);
differences.compare("columns", databaseObject1, databaseObject2, new ObjectDifferences.CompareFunction() {
@Override
public boolean areEqual(Object referenceValue, Object compareToValue) {
List<Column> referenceList = (List) referenceValue;
List<Column> compareList = (List) compareToValue;
if (referenceList.size() != compareList.size()) {
return false;
}
for (int i = 0; i < referenceList.size(); i++) {
if (!StringUtils.trimToEmpty((referenceList.get(i)).getName()).equalsIgnoreCase(StringUtils.trimToEmpty(compareList.get(i).getName()))) {
return false;
}
}
return true;
}
});
differences.compare("backingIndex", databaseObject1, databaseObject2, new ObjectDifferences.StandardCompareFunction(chain.getSchemaComparisons(), accordingTo));
return differences;
}
use of liquibase.diff.ObjectDifferences in project liquibase by liquibase.
the class CatalogComparator method findDifferences.
@Override
public ObjectDifferences findDifferences(DatabaseObject databaseObject1, DatabaseObject databaseObject2, Database accordingTo, CompareControl compareControl, DatabaseObjectComparatorChain chain, Set<String> exclude) {
ObjectDifferences differences = new ObjectDifferences(compareControl);
differences.compare("name", databaseObject1, databaseObject2, new ObjectDifferences.DatabaseObjectNameCompareFunction(Schema.class, accordingTo));
return differences;
}
Aggregations