mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Use unique index rather than constraint when using formula [like lower(column)]
This commit is contained in:
@@ -35,6 +35,22 @@ public class IndexDefinition {
|
||||
this.platforms = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this can be used as a unique constraint.
|
||||
*/
|
||||
public boolean isUniqueConstraint() {
|
||||
return unique && noColumnFormulas();
|
||||
}
|
||||
|
||||
private boolean noColumnFormulas() {
|
||||
for (String column : columns) {
|
||||
if (column.contains("(")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is a unique constraint.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user