Search in sources :

Example 6 with UniqueConstraint

use of liquibase.structure.core.UniqueConstraint in project liquibase by liquibase.

the class UniqueConstraintComparator method hash.

@Override
public String[] hash(DatabaseObject databaseObject, Database accordingTo, DatabaseObjectComparatorChain chain) {
    List<String> hashes = new ArrayList<String>();
    if (databaseObject.getName() != null) {
        hashes.add(databaseObject.getName().toLowerCase());
    }
    Table table = ((UniqueConstraint) databaseObject).getTable();
    if (table != null) {
        hashes.addAll(Arrays.asList(DatabaseObjectComparatorFactory.getInstance().hash(table, chain.getSchemaComparisons(), accordingTo)));
    }
    return hashes.toArray(new String[hashes.size()]);
}
Also used : Table(liquibase.structure.core.Table) ArrayList(java.util.ArrayList) UniqueConstraint(liquibase.structure.core.UniqueConstraint)

Aggregations

UniqueConstraint (liquibase.structure.core.UniqueConstraint)6 ArrayList (java.util.ArrayList)3 Change (liquibase.change.Change)2 Column (liquibase.structure.core.Column)2 Index (liquibase.structure.core.Index)2 Table (liquibase.structure.core.Table)2 List (java.util.List)1 AddColumnConfig (liquibase.change.AddColumnConfig)1 AddUniqueConstraintChange (liquibase.change.core.AddUniqueConstraintChange)1 CreateIndexChange (liquibase.change.core.CreateIndexChange)1 DropIndexChange (liquibase.change.core.DropIndexChange)1 DropUniqueConstraintChange (liquibase.change.core.DropUniqueConstraintChange)1 OracleDatabase (liquibase.database.core.OracleDatabase)1 Difference (liquibase.diff.Difference)1 Schema (liquibase.structure.core.Schema)1 StringUtils (liquibase.util.StringUtils)1