diff --git a/src/main/java/liquibase/ext/hibernate/snapshot/UniqueConstraintSnapshotGenerator.java b/src/main/java/liquibase/ext/hibernate/snapshot/UniqueConstraintSnapshotGenerator.java index 95e9d205..2e0aa74b 100644 --- a/src/main/java/liquibase/ext/hibernate/snapshot/UniqueConstraintSnapshotGenerator.java +++ b/src/main/java/liquibase/ext/hibernate/snapshot/UniqueConstraintSnapshotGenerator.java @@ -9,6 +9,7 @@ import liquibase.structure.core.Index; import liquibase.structure.core.Table; import liquibase.structure.core.UniqueConstraint; +import liquibase.util.StringUtil; import org.hibernate.HibernateException; import java.math.BigInteger; @@ -116,7 +117,7 @@ protected Index getBackingIndex(UniqueConstraint uniqueConstraint, org.hibernate index.setRelation(uniqueConstraint.getRelation()); index.setColumns(uniqueConstraint.getColumns()); index.setUnique(true); - index.setName(hibernateTable.getName() + "_IX"); + index.setName(String.format("%s_%s_IX",hibernateTable.getName(), StringUtil.randomIdentifer(4))); return index; }