From 0d3b9a9b00652119a78ebd11d93e60a1920861e1 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 25 Sep 2013 12:39:57 +0800 Subject: [PATCH] #1002868 IDEMPIERE-1188 Invoice Price Variance for Average PO Costing. Add missing foreign key constraint. --- .../oracle/201309250432_IDEMPIERE-1188.sql | 11 +++++++++++ .../postgresql/201309250432_IDEMPIERE-1188.sql | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 migration/i1.0c-release/oracle/201309250432_IDEMPIERE-1188.sql create mode 100644 migration/i1.0c-release/postgresql/201309250432_IDEMPIERE-1188.sql diff --git a/migration/i1.0c-release/oracle/201309250432_IDEMPIERE-1188.sql b/migration/i1.0c-release/oracle/201309250432_IDEMPIERE-1188.sql new file mode 100644 index 0000000000..df26c6f8d5 --- /dev/null +++ b/migration/i1.0c-release/oracle/201309250432_IDEMPIERE-1188.sql @@ -0,0 +1,11 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +UPDATE M_CostDetail SET M_MatchInv_ID=NULL WHERE M_MatchInv_ID IS NOT NULL AND NOT EXISTS (SELECT a.M_MatchInv_ID FROM M_MatchInv a WHERE a.M_MatchInv_ID=M_CostDetail.M_MatchInv_ID) +; + +ALTER TABLE M_CostDetail ADD CONSTRAINT MCostDetail_MatchInv FOREIGN KEY(M_MatchInv_ID) REFERENCES M_MatchInv(M_MatchInv_ID) ON DELETE RESTRICT +; + +SELECT register_migration_script('201309250432_IDEMPIERE-1188.sql') FROM dual +; diff --git a/migration/i1.0c-release/postgresql/201309250432_IDEMPIERE-1188.sql b/migration/i1.0c-release/postgresql/201309250432_IDEMPIERE-1188.sql new file mode 100644 index 0000000000..966f82036c --- /dev/null +++ b/migration/i1.0c-release/postgresql/201309250432_IDEMPIERE-1188.sql @@ -0,0 +1,8 @@ +UPDATE M_CostDetail SET M_MatchInv_ID=NULL WHERE M_MatchInv_ID IS NOT NULL AND NOT EXISTS (SELECT a.M_MatchInv_ID FROM M_MatchInv a WHERE a.M_MatchInv_ID=M_CostDetail.M_MatchInv_ID) +; + +ALTER TABLE M_CostDetail ADD CONSTRAINT MCostDetail_MatchInv FOREIGN KEY(M_MatchInv_ID) REFERENCES M_MatchInv(M_MatchInv_ID) ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED +; + +SELECT register_migration_script('201309250432_IDEMPIERE-1188.sql') FROM dual +;