IDEMPIERE-5567 Support of UUID as Key - Constraints (FHCA-4195) (#1773)

* IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) - Fix unique constraints

* - Create/Complete Table must create the UU idx and constraint when it does not exist

* - Create 65 UUID constraints/indexes existing in database but missing in dictionary

* - Set all official UUID columns with the new UUID data type
This commit is contained in:
Carlos Ruiz 2023-04-12 06:22:53 +02:00 committed by GitHub
parent c80d53674a
commit a811b62b56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13889 additions and 4 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -235,12 +235,24 @@ public class CreateTable extends SvrProcess {
createColumn(table, elementID.getColumnName());
}
String uucolName = PO.getUUIDColumnName(p_tableName);
M_Element elementUU = M_Element.get(getCtx(), p_tableName + "_UU");
if (elementUU == null) { // Create Element <TableName> + _UU
elementUU = new M_Element(getCtx(), p_tableName + "_UU", p_entityType, get_TrxName());
elementUU = new M_Element(getCtx(), uucolName, p_entityType, get_TrxName());
elementUU.saveEx();
}
createColumn(table, elementUU.getColumnName());
if (createColumn(table, elementUU.getColumnName()) > 0) {
// UUID Index and Constraint
MTableIndex tiuu = new MTableIndex(table, table.getTableName() + "_uu_idx");
tiuu.setIsCreateConstraint(true);
tiuu.setIsUnique(true);
tiuu.setIsKey(table.isUUIDKeyTable());
tiuu.saveEx();
MColumn uuColumn = getColumn(table, uucolName);
MIndexColumn icuu = new MIndexColumn(tiuu, uuColumn, 10);
icuu.saveEx();
}
if (p_isCreateColValue)
createColumn(table, "Value");
@ -341,9 +353,9 @@ public class CreateTable extends SvrProcess {
ti.setIsKey(true);
ti.saveEx();
MIndexColumn ic = new MIndexColumn(ti, new MColumn(getCtx(), colLanguageID, get_TrxName()), 1);
MIndexColumn ic = new MIndexColumn(ti, new MColumn(getCtx(), colLanguageID, get_TrxName()), 10);
ic.saveEx();
ic = new MIndexColumn(ti, new MColumn(getCtx(), colElementID, get_TrxName()), 2);
ic = new MIndexColumn(ti, new MColumn(getCtx(), colElementID, get_TrxName()), 20);
ic.saveEx();
addLog(Msg.getMsg(getCtx(), "TrlCreatedSyncColumnValidateIndex"));