Skip to content

Commit

Permalink
Merge pull request #204 from volvogroup-mobility/fix/Issue#191-unnece…
Browse files Browse the repository at this point in the history
…ssery-recreation-of-unique-constraints

Set UniqueConstraint.clustered to false
  • Loading branch information
nvoxland authored Sep 2, 2019
2 parents 78515a0 + 3e9a814 commit 3f9bb20
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ protected void addTo(DatabaseObject foundObject, DatabaseSnapshot snapshot) thro
UniqueConstraint uniqueConstraint = new UniqueConstraint();
uniqueConstraint.setName(hibernateUnique.getName());
uniqueConstraint.setTable(table);
uniqueConstraint.setClustered(false); // No way to set true via Hibernate
Iterator columnIterator = hibernateUnique.getColumnIterator();
int i = 0;
while (columnIterator.hasNext()) {
Expand All @@ -65,6 +66,7 @@ protected void addTo(DatabaseObject foundObject, DatabaseSnapshot snapshot) thro
if (column.isUnique()) {
UniqueConstraint uniqueConstraint = new UniqueConstraint();
uniqueConstraint.setTable(table);
uniqueConstraint.setClustered(false); // No way to set true via Hibernate
String name = "UC_" + table.getName().toUpperCase() + column.getName().toUpperCase() + "_COL";
if (name.length() > 64) {
name = name.substring(0, 63);
Expand Down

0 comments on commit 3f9bb20

Please sign in to comment.