IDEMPIERE-5567 Support of UUID as Key (FHCA-4195) (#2142)
- fix for scripts to avoid errors when the table doesn't have the ID column, for example updating AD_Ref_Table throws error because there is no AD_Ref_Table_ID
This commit is contained in:
parent
b52fbbd3f2
commit
8bbdceae0a
|
@ -167,7 +167,7 @@ BEGIN
|
||||||
FOR r IN (
|
FOR r IN (
|
||||||
SELECT DISTINCT t.TableName, cl.AD_Table_ID
|
SELECT DISTINCT t.TableName, cl.AD_Table_ID
|
||||||
FROM AD_ChangeLog cl
|
FROM AD_ChangeLog cl
|
||||||
JOIN AD_Table t ON (cl.AD_Table_ID=t.AD_Table_ID)
|
JOIN AD_Table t ON (cl.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE cl.Record_UU IS NULL
|
WHERE cl.Record_UU IS NULL
|
||||||
AND cl.Record_ID IS NOT NULL
|
AND cl.Record_ID IS NOT NULL
|
||||||
AND cl.EventChangeLog!='D'
|
AND cl.EventChangeLog!='D'
|
||||||
|
|
|
@ -23,7 +23,7 @@ BEGIN
|
||||||
FOR r IN (
|
FOR r IN (
|
||||||
SELECT DISTINCT t.TableName, ri.AD_Table_ID
|
SELECT DISTINCT t.TableName, ri.AD_Table_ID
|
||||||
FROM AD_RecentItem ri
|
FROM AD_RecentItem ri
|
||||||
JOIN AD_Table t ON (ri.AD_Table_ID=t.AD_Table_ID)
|
JOIN AD_Table t ON (ri.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE ri.Record_UU IS NULL
|
WHERE ri.Record_UU IS NULL
|
||||||
AND ri.Record_ID IS NOT NULL
|
AND ri.Record_ID IS NOT NULL
|
||||||
) LOOP
|
) LOOP
|
||||||
|
|
|
@ -249,7 +249,8 @@ DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
FOR r IN (
|
FOR r IN (
|
||||||
SELECT DISTINCT t.TableName, at.AD_Table_ID
|
SELECT DISTINCT t.TableName, at.AD_Table_ID
|
||||||
FROM AD_Attachment at JOIN AD_Table t ON (at.AD_Table_ID=t.AD_Table_ID)
|
FROM AD_Attachment at
|
||||||
|
JOIN AD_Table t ON (at.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE at.Record_UU IS NULL AND at.Record_ID IS NOT NULL
|
WHERE at.Record_UU IS NULL AND at.Record_ID IS NOT NULL
|
||||||
) LOOP
|
) LOOP
|
||||||
cmd := 'UPDATE AD_Attachment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
cmd := 'UPDATE AD_Attachment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
||||||
|
@ -260,7 +261,8 @@ BEGIN
|
||||||
END LOOP;
|
END LOOP;
|
||||||
FOR r IN (
|
FOR r IN (
|
||||||
SELECT DISTINCT t.TableName, ch.AD_Table_ID
|
SELECT DISTINCT t.TableName, ch.AD_Table_ID
|
||||||
FROM CM_Chat ch JOIN AD_Table t ON (ch.AD_Table_ID=t.AD_Table_ID)
|
FROM CM_Chat ch
|
||||||
|
JOIN AD_Table t ON (ch.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE ch.Record_UU IS NULL AND ch.Record_ID IS NOT NULL
|
WHERE ch.Record_UU IS NULL AND ch.Record_ID IS NOT NULL
|
||||||
) LOOP
|
) LOOP
|
||||||
cmd := 'UPDATE CM_Chat SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
cmd := 'UPDATE CM_Chat SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
||||||
|
@ -271,7 +273,8 @@ BEGIN
|
||||||
END LOOP;
|
END LOOP;
|
||||||
FOR r IN (
|
FOR r IN (
|
||||||
SELECT DISTINCT t.TableName, po.AD_Table_ID
|
SELECT DISTINCT t.TableName, po.AD_Table_ID
|
||||||
FROM AD_PostIt po JOIN AD_Table t ON (po.AD_Table_ID=t.AD_Table_ID)
|
FROM AD_PostIt po
|
||||||
|
JOIN AD_Table t ON (po.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE po.Record_UU IS NULL AND po.Record_ID IS NOT NULL
|
WHERE po.Record_UU IS NULL AND po.Record_ID IS NOT NULL
|
||||||
) LOOP
|
) LOOP
|
||||||
cmd := 'UPDATE AD_PostIt SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
cmd := 'UPDATE AD_PostIt SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
||||||
|
@ -282,7 +285,8 @@ BEGIN
|
||||||
END LOOP;
|
END LOOP;
|
||||||
FOR r IN (
|
FOR r IN (
|
||||||
SELECT DISTINCT t.TableName, la.AD_Table_ID
|
SELECT DISTINCT t.TableName, la.AD_Table_ID
|
||||||
FROM AD_LabelAssignment la JOIN AD_Table t ON (la.AD_Table_ID=t.AD_Table_ID)
|
FROM AD_LabelAssignment la
|
||||||
|
JOIN AD_Table t ON (la.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE la.Record_UU IS NULL AND la.Record_ID IS NOT NULL
|
WHERE la.Record_UU IS NULL AND la.Record_ID IS NOT NULL
|
||||||
) LOOP
|
) LOOP
|
||||||
cmd := 'UPDATE AD_LabelAssignment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
cmd := 'UPDATE AD_LabelAssignment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
||||||
|
|
|
@ -51,7 +51,7 @@ BEGIN
|
||||||
FOR r IN (
|
FOR r IN (
|
||||||
SELECT DISTINCT t.TableName, a.AD_Table_ID
|
SELECT DISTINCT t.TableName, a.AD_Table_ID
|
||||||
FROM AD_Archive a
|
FROM AD_Archive a
|
||||||
JOIN AD_Table t ON (a.AD_Table_ID=t.AD_Table_ID)
|
JOIN AD_Table t ON (a.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE a.Record_UU IS NULL
|
WHERE a.Record_UU IS NULL
|
||||||
AND a.Record_ID > 0
|
AND a.Record_ID > 0
|
||||||
) LOOP
|
) LOOP
|
||||||
|
|
|
@ -194,7 +194,7 @@ BEGIN
|
||||||
FOR r IN (
|
FOR r IN (
|
||||||
SELECT DISTINCT t.TableName, a.AD_Table_ID
|
SELECT DISTINCT t.TableName, a.AD_Table_ID
|
||||||
FROM R_Request a
|
FROM R_Request a
|
||||||
JOIN AD_Table t ON (a.AD_Table_ID=t.AD_Table_ID)
|
JOIN AD_Table t ON (a.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE a.Record_UU IS NULL
|
WHERE a.Record_UU IS NULL
|
||||||
AND a.Record_ID > 0
|
AND a.Record_ID > 0
|
||||||
) LOOP
|
) LOOP
|
||||||
|
|
|
@ -95,7 +95,7 @@ BEGIN
|
||||||
FOR r IN (
|
FOR r IN (
|
||||||
SELECT DISTINCT t.TableName, a.AD_Table_ID
|
SELECT DISTINCT t.TableName, a.AD_Table_ID
|
||||||
FROM AD_Package_Imp_Detail a
|
FROM AD_Package_Imp_Detail a
|
||||||
JOIN AD_Table t ON (a.AD_Table_ID=t.AD_Table_ID)
|
JOIN AD_Table t ON (a.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE a.Record_UU IS NULL
|
WHERE a.Record_UU IS NULL
|
||||||
AND a.AD_Table_ID > 0
|
AND a.AD_Table_ID > 0
|
||||||
AND a.Record_ID > 0
|
AND a.Record_ID > 0
|
||||||
|
|
|
@ -164,7 +164,7 @@ BEGIN
|
||||||
FOR r IN
|
FOR r IN
|
||||||
SELECT DISTINCT t.TableName, cl.AD_Table_ID
|
SELECT DISTINCT t.TableName, cl.AD_Table_ID
|
||||||
FROM AD_ChangeLog cl
|
FROM AD_ChangeLog cl
|
||||||
JOIN AD_Table t ON (cl.AD_Table_ID=t.AD_Table_ID)
|
JOIN AD_Table t ON (cl.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE cl.Record_UU IS NULL
|
WHERE cl.Record_UU IS NULL
|
||||||
AND cl.Record_ID IS NOT NULL
|
AND cl.Record_ID IS NOT NULL
|
||||||
AND cl.EventChangeLog!='D'
|
AND cl.EventChangeLog!='D'
|
||||||
|
|
|
@ -20,7 +20,7 @@ BEGIN
|
||||||
FOR r IN
|
FOR r IN
|
||||||
SELECT DISTINCT t.TableName, ri.AD_Table_ID
|
SELECT DISTINCT t.TableName, ri.AD_Table_ID
|
||||||
FROM AD_RecentItem ri
|
FROM AD_RecentItem ri
|
||||||
JOIN AD_Table t ON (ri.AD_Table_ID=t.AD_Table_ID)
|
JOIN AD_Table t ON (ri.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE ri.Record_UU IS NULL
|
WHERE ri.Record_UU IS NULL
|
||||||
AND ri.Record_ID IS NOT NULL
|
AND ri.Record_ID IS NOT NULL
|
||||||
LOOP
|
LOOP
|
||||||
|
|
|
@ -246,7 +246,8 @@ DECLARE
|
||||||
BEGIN
|
BEGIN
|
||||||
FOR r IN
|
FOR r IN
|
||||||
SELECT DISTINCT t.TableName, at.AD_Table_ID
|
SELECT DISTINCT t.TableName, at.AD_Table_ID
|
||||||
FROM AD_Attachment at JOIN AD_Table t ON (at.AD_Table_ID=t.AD_Table_ID)
|
FROM AD_Attachment at
|
||||||
|
JOIN AD_Table t ON (at.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE at.Record_UU IS NULL AND at.Record_ID IS NOT NULL
|
WHERE at.Record_UU IS NULL AND at.Record_ID IS NOT NULL
|
||||||
LOOP
|
LOOP
|
||||||
cmd := 'UPDATE AD_Attachment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
cmd := 'UPDATE AD_Attachment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
||||||
|
@ -258,7 +259,8 @@ BEGIN
|
||||||
END LOOP;
|
END LOOP;
|
||||||
FOR r IN
|
FOR r IN
|
||||||
SELECT DISTINCT t.TableName, ch.AD_Table_ID
|
SELECT DISTINCT t.TableName, ch.AD_Table_ID
|
||||||
FROM CM_Chat ch JOIN AD_Table t ON (ch.AD_Table_ID=t.AD_Table_ID)
|
FROM CM_Chat ch
|
||||||
|
JOIN AD_Table t ON (ch.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE ch.Record_UU IS NULL AND ch.Record_ID IS NOT NULL
|
WHERE ch.Record_UU IS NULL AND ch.Record_ID IS NOT NULL
|
||||||
LOOP
|
LOOP
|
||||||
cmd := 'UPDATE CM_Chat SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
cmd := 'UPDATE CM_Chat SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
||||||
|
@ -270,7 +272,8 @@ BEGIN
|
||||||
END LOOP;
|
END LOOP;
|
||||||
FOR r IN
|
FOR r IN
|
||||||
SELECT DISTINCT t.TableName, po.AD_Table_ID
|
SELECT DISTINCT t.TableName, po.AD_Table_ID
|
||||||
FROM AD_PostIt po JOIN AD_Table t ON (po.AD_Table_ID=t.AD_Table_ID)
|
FROM AD_PostIt po
|
||||||
|
JOIN AD_Table t ON (po.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE po.Record_UU IS NULL AND po.Record_ID IS NOT NULL
|
WHERE po.Record_UU IS NULL AND po.Record_ID IS NOT NULL
|
||||||
LOOP
|
LOOP
|
||||||
cmd := 'UPDATE AD_PostIt SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
cmd := 'UPDATE AD_PostIt SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
||||||
|
@ -282,7 +285,8 @@ BEGIN
|
||||||
END LOOP;
|
END LOOP;
|
||||||
FOR r IN
|
FOR r IN
|
||||||
SELECT DISTINCT t.TableName, la.AD_Table_ID
|
SELECT DISTINCT t.TableName, la.AD_Table_ID
|
||||||
FROM AD_LabelAssignment la JOIN AD_Table t ON (la.AD_Table_ID=t.AD_Table_ID)
|
FROM AD_LabelAssignment la
|
||||||
|
JOIN AD_Table t ON (la.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE la.Record_UU IS NULL AND la.Record_ID IS NOT NULL
|
WHERE la.Record_UU IS NULL AND la.Record_ID IS NOT NULL
|
||||||
LOOP
|
LOOP
|
||||||
cmd := 'UPDATE AD_LabelAssignment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
cmd := 'UPDATE AD_LabelAssignment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName
|
||||||
|
|
|
@ -47,7 +47,7 @@ BEGIN
|
||||||
FOR r IN
|
FOR r IN
|
||||||
SELECT DISTINCT t.TableName, a.AD_Table_ID
|
SELECT DISTINCT t.TableName, a.AD_Table_ID
|
||||||
FROM AD_Archive a
|
FROM AD_Archive a
|
||||||
JOIN AD_Table t ON (a.AD_Table_ID=t.AD_Table_ID)
|
JOIN AD_Table t ON (a.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE a.Record_UU IS NULL
|
WHERE a.Record_UU IS NULL
|
||||||
AND a.Record_ID > 0
|
AND a.Record_ID > 0
|
||||||
LOOP
|
LOOP
|
||||||
|
|
|
@ -191,7 +191,7 @@ BEGIN
|
||||||
FOR r IN
|
FOR r IN
|
||||||
SELECT DISTINCT t.TableName, a.AD_Table_ID
|
SELECT DISTINCT t.TableName, a.AD_Table_ID
|
||||||
FROM R_Request a
|
FROM R_Request a
|
||||||
JOIN AD_Table t ON (a.AD_Table_ID=t.AD_Table_ID)
|
JOIN AD_Table t ON (a.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE a.Record_UU IS NULL
|
WHERE a.Record_UU IS NULL
|
||||||
AND a.Record_ID > 0
|
AND a.Record_ID > 0
|
||||||
LOOP
|
LOOP
|
||||||
|
|
|
@ -91,7 +91,7 @@ BEGIN
|
||||||
FOR r IN
|
FOR r IN
|
||||||
SELECT DISTINCT t.TableName, a.AD_Table_ID
|
SELECT DISTINCT t.TableName, a.AD_Table_ID
|
||||||
FROM AD_Package_Imp_Detail a
|
FROM AD_Package_Imp_Detail a
|
||||||
JOIN AD_Table t ON (a.AD_Table_ID=t.AD_Table_ID)
|
JOIN AD_Table t ON (a.AD_Table_ID=t.AD_Table_ID AND EXISTS (SELECT 1 FROM AD_Column WHERE ColumnName=t.TableName||'_ID'))
|
||||||
WHERE a.Record_UU IS NULL
|
WHERE a.Record_UU IS NULL
|
||||||
AND a.AD_Table_ID > 0
|
AND a.AD_Table_ID > 0
|
||||||
AND a.Record_ID > 0
|
AND a.Record_ID > 0
|
||||||
|
|
Loading…
Reference in New Issue