diff --git a/migration/iD11/oracle/202304151832_IDEMPIERE-5567.sql b/migration/iD11/oracle/202304151832_IDEMPIERE-5567.sql index b75108dee7..889b31a2a9 100644 --- a/migration/iD11/oracle/202304151832_IDEMPIERE-5567.sql +++ b/migration/iD11/oracle/202304151832_IDEMPIERE-5567.sql @@ -167,7 +167,7 @@ BEGIN FOR r IN ( SELECT DISTINCT t.TableName, cl.AD_Table_ID 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 AND cl.Record_ID IS NOT NULL AND cl.EventChangeLog!='D' diff --git a/migration/iD11/oracle/202305231609_IDEMPIERE-5567.sql b/migration/iD11/oracle/202305231609_IDEMPIERE-5567.sql index d2c2d4098e..15846eb4a6 100644 --- a/migration/iD11/oracle/202305231609_IDEMPIERE-5567.sql +++ b/migration/iD11/oracle/202305231609_IDEMPIERE-5567.sql @@ -23,7 +23,7 @@ BEGIN FOR r IN ( SELECT DISTINCT t.TableName, ri.AD_Table_ID 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 AND ri.Record_ID IS NOT NULL ) LOOP diff --git a/migration/iD11/oracle/202305291332_IDEMPIERE-5567.sql b/migration/iD11/oracle/202305291332_IDEMPIERE-5567.sql index 1482fa0103..781cec0f57 100644 --- a/migration/iD11/oracle/202305291332_IDEMPIERE-5567.sql +++ b/migration/iD11/oracle/202305291332_IDEMPIERE-5567.sql @@ -249,7 +249,8 @@ DECLARE BEGIN FOR r IN ( 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 ) LOOP cmd := 'UPDATE AD_Attachment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName @@ -260,7 +261,8 @@ BEGIN END LOOP; FOR r IN ( 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 ) LOOP cmd := 'UPDATE CM_Chat SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName @@ -271,7 +273,8 @@ BEGIN END LOOP; FOR r IN ( 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 ) LOOP cmd := 'UPDATE AD_PostIt SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName @@ -282,7 +285,8 @@ BEGIN END LOOP; FOR r IN ( 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 ) LOOP cmd := 'UPDATE AD_LabelAssignment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName diff --git a/migration/iD11/oracle/202306101412_IDEMPIERE-5567-Archive.sql b/migration/iD11/oracle/202306101412_IDEMPIERE-5567-Archive.sql index 4720e39319..fd370a35d6 100644 --- a/migration/iD11/oracle/202306101412_IDEMPIERE-5567-Archive.sql +++ b/migration/iD11/oracle/202306101412_IDEMPIERE-5567-Archive.sql @@ -51,7 +51,7 @@ BEGIN FOR r IN ( SELECT DISTINCT t.TableName, a.AD_Table_ID 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 AND a.Record_ID > 0 ) LOOP diff --git a/migration/iD11/oracle/202306241143_IDEMPIERE-5567-Request.sql b/migration/iD11/oracle/202306241143_IDEMPIERE-5567-Request.sql index 93485fc657..ad0809f59f 100644 --- a/migration/iD11/oracle/202306241143_IDEMPIERE-5567-Request.sql +++ b/migration/iD11/oracle/202306241143_IDEMPIERE-5567-Request.sql @@ -194,7 +194,7 @@ BEGIN FOR r IN ( SELECT DISTINCT t.TableName, a.AD_Table_ID 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 AND a.Record_ID > 0 ) LOOP diff --git a/migration/iD11/oracle/202311261658_IDEMPIERE-5567-PackInDetail.sql b/migration/iD11/oracle/202311261658_IDEMPIERE-5567-PackInDetail.sql index a5cb7f8ac1..9b650947f7 100644 --- a/migration/iD11/oracle/202311261658_IDEMPIERE-5567-PackInDetail.sql +++ b/migration/iD11/oracle/202311261658_IDEMPIERE-5567-PackInDetail.sql @@ -95,7 +95,7 @@ BEGIN FOR r IN ( SELECT DISTINCT t.TableName, a.AD_Table_ID 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 AND a.AD_Table_ID > 0 AND a.Record_ID > 0 diff --git a/migration/iD11/postgresql/202304151832_IDEMPIERE-5567.sql b/migration/iD11/postgresql/202304151832_IDEMPIERE-5567.sql index d57d7f7558..6f0fe25811 100644 --- a/migration/iD11/postgresql/202304151832_IDEMPIERE-5567.sql +++ b/migration/iD11/postgresql/202304151832_IDEMPIERE-5567.sql @@ -164,7 +164,7 @@ BEGIN FOR r IN SELECT DISTINCT t.TableName, cl.AD_Table_ID 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 AND cl.Record_ID IS NOT NULL AND cl.EventChangeLog!='D' diff --git a/migration/iD11/postgresql/202305231609_IDEMPIERE-5567.sql b/migration/iD11/postgresql/202305231609_IDEMPIERE-5567.sql index 0d41d70357..79c7fe8e43 100644 --- a/migration/iD11/postgresql/202305231609_IDEMPIERE-5567.sql +++ b/migration/iD11/postgresql/202305231609_IDEMPIERE-5567.sql @@ -20,7 +20,7 @@ BEGIN FOR r IN SELECT DISTINCT t.TableName, ri.AD_Table_ID 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 AND ri.Record_ID IS NOT NULL LOOP diff --git a/migration/iD11/postgresql/202305291332_IDEMPIERE-5567.sql b/migration/iD11/postgresql/202305291332_IDEMPIERE-5567.sql index 2019f432fd..fc3d2ccf7c 100644 --- a/migration/iD11/postgresql/202305291332_IDEMPIERE-5567.sql +++ b/migration/iD11/postgresql/202305291332_IDEMPIERE-5567.sql @@ -246,7 +246,8 @@ DECLARE BEGIN FOR r IN 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 LOOP cmd := 'UPDATE AD_Attachment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName @@ -258,7 +259,8 @@ BEGIN END LOOP; FOR r IN 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 LOOP cmd := 'UPDATE CM_Chat SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName @@ -270,7 +272,8 @@ BEGIN END LOOP; FOR r IN 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 LOOP cmd := 'UPDATE AD_PostIt SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName @@ -282,7 +285,8 @@ BEGIN END LOOP; FOR r IN 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 LOOP cmd := 'UPDATE AD_LabelAssignment SET Record_UU=(SELECT ' || r.TableName || '_UU FROM ' || r.TableName diff --git a/migration/iD11/postgresql/202306101412_IDEMPIERE-5567-Archive.sql b/migration/iD11/postgresql/202306101412_IDEMPIERE-5567-Archive.sql index c6a43e8a3e..22c261ed0b 100644 --- a/migration/iD11/postgresql/202306101412_IDEMPIERE-5567-Archive.sql +++ b/migration/iD11/postgresql/202306101412_IDEMPIERE-5567-Archive.sql @@ -47,7 +47,7 @@ BEGIN FOR r IN SELECT DISTINCT t.TableName, a.AD_Table_ID 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 AND a.Record_ID > 0 LOOP diff --git a/migration/iD11/postgresql/202306241143_IDEMPIERE-5567-Request.sql b/migration/iD11/postgresql/202306241143_IDEMPIERE-5567-Request.sql index d3ef9c9362..c0a1a94de7 100644 --- a/migration/iD11/postgresql/202306241143_IDEMPIERE-5567-Request.sql +++ b/migration/iD11/postgresql/202306241143_IDEMPIERE-5567-Request.sql @@ -191,7 +191,7 @@ BEGIN FOR r IN SELECT DISTINCT t.TableName, a.AD_Table_ID 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 AND a.Record_ID > 0 LOOP diff --git a/migration/iD11/postgresql/202311261658_IDEMPIERE-5567-PackInDetail.sql b/migration/iD11/postgresql/202311261658_IDEMPIERE-5567-PackInDetail.sql index 2ec1c7cf33..0738394a74 100644 --- a/migration/iD11/postgresql/202311261658_IDEMPIERE-5567-PackInDetail.sql +++ b/migration/iD11/postgresql/202311261658_IDEMPIERE-5567-PackInDetail.sql @@ -91,7 +91,7 @@ BEGIN FOR r IN SELECT DISTINCT t.TableName, a.AD_Table_ID 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 AND a.AD_Table_ID > 0 AND a.Record_ID > 0