From 1a4a843db26f6c3c208fa5dfdca7933b7cb76db2 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Thu, 31 Dec 2009 12:48:21 +0000 Subject: Bug 520318: Add remove_from_db to Bugzilla:Group and use it to delete groups in editgroups.cgi Patch by Max Kanat-Alexander r=dkl, a=LpSolit --- Bugzilla/Install/DB.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Bugzilla/Install/DB.pm') diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm index adbcb285f..7a9fa72d8 100644 --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -594,6 +594,8 @@ sub update_table_definitions { _add_allows_unconfirmed_to_product_table(); + _convert_flagtypes_fks_to_set_null(); + ################################################################ # New --TABLE-- changes should go *** A B O V E *** this point # ################################################################ @@ -3340,6 +3342,18 @@ sub _add_allows_unconfirmed_to_product_table { } } +sub _convert_flagtypes_fks_to_set_null { + my $dbh = Bugzilla->dbh; + foreach my $column (qw(request_group_id grant_group_id)) { + my $fk = $dbh->bz_fk_info('flagtypes', $column); + if ($fk and !defined $fk->{DELETE}) { + # checksetup will re-create the FK with the appropriate definition + # at the end of its table upgrades, so we just drop it here. + $dbh->bz_drop_fk('flagtypes', $column); + } + } +} + 1; __END__ -- cgit v1.2.3-24-g4f1b