From 15dd1f43abcb72da1ba045a008ca8952ab5e4d6b Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 19 Mar 2019 10:59:34 -0300 Subject: [PATCH] IDEMPIERE-2395 NoteDelete leaving orphan attachments / fix some orphans in GardenWorld seed --- migration/i6.2/oracle/201903191017_IDEMPIERE-2395.sql | 10 ++++++++++ .../i6.2/postgresql/201903191017_IDEMPIERE-2395.sql | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 migration/i6.2/oracle/201903191017_IDEMPIERE-2395.sql create mode 100644 migration/i6.2/postgresql/201903191017_IDEMPIERE-2395.sql diff --git a/migration/i6.2/oracle/201903191017_IDEMPIERE-2395.sql b/migration/i6.2/oracle/201903191017_IDEMPIERE-2395.sql new file mode 100644 index 0000000000..b1b18da596 --- /dev/null +++ b/migration/i6.2/oracle/201903191017_IDEMPIERE-2395.sql @@ -0,0 +1,10 @@ +-- IDEMPIERE-2395 - clean orphan ad_note in seed +DELETE FROM ad_note WHERE ad_table_id=53043 AND record_id NOT IN (SELECT PP_MRP_ID FROM PP_MRP); + +DELETE FROM ad_attachment WHERE ad_table_id=389 AND record_id NOT IN (SELECT ad_note_id FROM ad_note); + +DELETE FROM ad_treenodecmt WHERE node_id>0 AND node_id NOT IN (SELECT cm_template_id FROM cm_template); + +SELECT register_migration_script('201903191017_IDEMPIERE-2395.sql') FROM dual +; + diff --git a/migration/i6.2/postgresql/201903191017_IDEMPIERE-2395.sql b/migration/i6.2/postgresql/201903191017_IDEMPIERE-2395.sql new file mode 100644 index 0000000000..b1b18da596 --- /dev/null +++ b/migration/i6.2/postgresql/201903191017_IDEMPIERE-2395.sql @@ -0,0 +1,10 @@ +-- IDEMPIERE-2395 - clean orphan ad_note in seed +DELETE FROM ad_note WHERE ad_table_id=53043 AND record_id NOT IN (SELECT PP_MRP_ID FROM PP_MRP); + +DELETE FROM ad_attachment WHERE ad_table_id=389 AND record_id NOT IN (SELECT ad_note_id FROM ad_note); + +DELETE FROM ad_treenodecmt WHERE node_id>0 AND node_id NOT IN (SELECT cm_template_id FROM cm_template); + +SELECT register_migration_script('201903191017_IDEMPIERE-2395.sql') FROM dual +; +