IDEMPIERE-965 the "create table" process must also create the unique index for the UU column when found
This commit is contained in:
parent
497cf480af
commit
013d5c4fd4
|
@ -300,19 +300,6 @@ public class UUIDGenerator extends SvrProcess {
|
|||
}
|
||||
}
|
||||
|
||||
if (no != -1)
|
||||
{
|
||||
StringBuilder indexName = new StringBuilder().append(column.getColumnName()).append("_idx");
|
||||
if (indexName.length() > 30) {
|
||||
int i = indexName.length() - 31;
|
||||
indexName = new StringBuilder().append(column.getColumnName().substring(0, column.getColumnName().length() - i));
|
||||
indexName.append("_uu_idx");
|
||||
}
|
||||
StringBuilder indexSql = new StringBuilder("CREATE UNIQUE INDEX ").append(indexName).append(" ON ").append(tableName)
|
||||
.append("(").append(column.getColumnName()).append(")");
|
||||
DB.executeUpdateEx(indexSql.toString(), null);
|
||||
}
|
||||
|
||||
if (no == -1)
|
||||
{
|
||||
StringBuilder msg = new StringBuilder("@Error@ ");
|
||||
|
|
|
@ -543,7 +543,17 @@ public class MColumn extends X_AD_Column
|
|||
+ " FOREIGN KEY (" + getColumnName() + ") REFERENCES "
|
||||
+ AD_Table(AD_Table_ID) ON DELETE CASCADE
|
||||
**/
|
||||
|
||||
// IDEMPIERE-965
|
||||
if (getColumnName().equals(PO.getUUIDColumnName(tableName))) {
|
||||
StringBuilder indexName = new StringBuilder().append(getColumnName()).append("_idx");
|
||||
if (indexName.length() > 30) {
|
||||
int i = indexName.length() - 31;
|
||||
indexName = new StringBuilder().append(getColumnName().substring(0, getColumnName().length() - i));
|
||||
indexName.append("_uu_idx");
|
||||
}
|
||||
StringBuilder msgreturn = new StringBuilder("CONSTRAINT ").append(indexName).append(" UNIQUE (").append(getColumnName()).append(")");
|
||||
return msgreturn.toString();
|
||||
}
|
||||
return "";
|
||||
} // getConstraint
|
||||
|
||||
|
|
Loading…
Reference in New Issue