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:
parent
c80d53674a
commit
a811b62b56
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -235,12 +235,24 @@ public class CreateTable extends SvrProcess {
|
||||||
createColumn(table, elementID.getColumnName());
|
createColumn(table, elementID.getColumnName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String uucolName = PO.getUUIDColumnName(p_tableName);
|
||||||
M_Element elementUU = M_Element.get(getCtx(), p_tableName + "_UU");
|
M_Element elementUU = M_Element.get(getCtx(), p_tableName + "_UU");
|
||||||
if (elementUU == null) { // Create Element <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();
|
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)
|
if (p_isCreateColValue)
|
||||||
createColumn(table, "Value");
|
createColumn(table, "Value");
|
||||||
|
@ -341,9 +353,9 @@ public class CreateTable extends SvrProcess {
|
||||||
ti.setIsKey(true);
|
ti.setIsKey(true);
|
||||||
ti.saveEx();
|
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.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();
|
ic.saveEx();
|
||||||
|
|
||||||
addLog(Msg.getMsg(getCtx(), "TrlCreatedSyncColumnValidateIndex"));
|
addLog(Msg.getMsg(getCtx(), "TrlCreatedSyncColumnValidateIndex"));
|
||||||
|
|
Loading…
Reference in New Issue