IDEMPIERE-965 the "create table" process must also create the unique index for the UU column when found

This commit is contained in:
Carlos Ruiz 2013-05-28 12:09:17 -05:00
parent 497cf480af
commit 013d5c4fd4
2 changed files with 11 additions and 14 deletions

View File

@ -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@ ");

View File

@ -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