From 23c63e06693b324f5ea61555fd150ac4a158679a Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 12 Jul 2007 07:40:02 +0000 Subject: Bug 387831: Deleting products does not clean up the component_cc table - Patch by Frédéric Buclin r/a=mkanat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- editproducts.cgi | 9 ++++++++- sanitycheck.cgi | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/editproducts.cgi b/editproducts.cgi index b458f60bf..dac5799ad 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -408,9 +408,16 @@ if ($action eq 'delete') { $dbh->bz_lock_tables('products WRITE', 'components WRITE', 'versions WRITE', 'milestones WRITE', - 'group_control_map WRITE', + 'group_control_map WRITE', 'component_cc WRITE', 'flaginclusions WRITE', 'flagexclusions WRITE'); + my $comp_ids = $dbh->selectcol_arrayref('SELECT id FROM components + WHERE product_id = ?', + undef, $product->id); + + $dbh->do('DELETE FROM component_cc WHERE component_id IN + (' . join(',', @$comp_ids) . ')') if scalar(@$comp_ids); + $dbh->do("DELETE FROM components WHERE product_id = ?", undef, $product->id); diff --git a/sanitycheck.cgi b/sanitycheck.cgi index 58033b828..db25f5842 100755 --- a/sanitycheck.cgi +++ b/sanitycheck.cgi @@ -453,7 +453,8 @@ CrossCheck("profiles", "userid", ["tokens", "userid"], ["user_group_map", "user_id"], ["components", "initialowner", "name"], - ["components", "initialqacontact", "name"]); + ["components", "initialqacontact", "name"], + ["component_cc", "user_id"]); CrossCheck("products", "id", ["bugs", "product_id", "bug_id"], @@ -464,6 +465,9 @@ CrossCheck("products", "id", ["flaginclusions", "product_id", "type_id"], ["flagexclusions", "product_id", "type_id"]); +CrossCheck("components", "id", + ["component_cc", "component_id"]); + # Check the former enum types -mkanat@bugzilla.org CrossCheck("bug_status", "value", ["bugs", "bug_status", "bug_id"]); -- cgit v1.2.3-24-g4f1b