From 51bdc50c7ff7caab9c57a67d9cc168347e2d1a11 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Thu, 8 Apr 2010 12:12:42 +0200 Subject: Bug 69621: Remove the keyword cache (which is not updated on keyword rename/delete) r/a=mkanat --- Bugzilla/Install/DB.pm | 46 +++------------------------------------------- 1 file changed, 3 insertions(+), 43 deletions(-) (limited to 'Bugzilla/Install/DB.pm') diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm index 1a3ffc69b..81372da71 100644 --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -147,7 +147,6 @@ sub update_table_definitions { _add_bug_vote_cache(); _update_product_name_definition(); - _add_bug_keyword_cache(); $dbh->bz_add_column('profiles', 'disabledtext', {TYPE => 'MEDIUMTEXT', NOTNULL => 1}, ''); @@ -358,8 +357,6 @@ sub update_table_definitions { # Add defaults for some fields that should have them but didn't. $dbh->bz_alter_column('bugs', 'status_whiteboard', {TYPE => 'MEDIUMTEXT', NOTNULL => 1, DEFAULT => "''"}); - $dbh->bz_alter_column('bugs', 'keywords', - {TYPE => 'MEDIUMTEXT', NOTNULL => 1, DEFAULT => "''"}); if ($dbh->bz_column_info('bugs', 'votes')) { $dbh->bz_alter_column('bugs', 'votes', {TYPE => 'INT3', NOTNULL => 1, DEFAULT => '0'}); @@ -605,6 +602,9 @@ sub update_table_definitions { # 2009-11-14 dkl@redhat.com - Bug 310450 $dbh->bz_add_column('bugs_activity', 'comment_id', {TYPE => 'INT3'}); + # 2010-04-07 LpSolit@gmail.com - Bug 69621 + $dbh->bz_drop_column('bugs', 'keywords'); + ################################################################ # New --TABLE-- changes should go *** A B O V E *** this point # ################################################################ @@ -691,46 +691,6 @@ sub _update_product_name_definition { } } -sub _add_bug_keyword_cache { - my $dbh = Bugzilla->dbh; - # 2000-01-16 Added a "keywords" field to the bugs table, which - # contains a string copy of the entries of the keywords table for this - # bug. This is so that I can easily sort and display a keywords - # column in bug lists. - - if (!$dbh->bz_column_info('bugs', 'keywords')) { - $dbh->bz_add_column('bugs', 'keywords', - {TYPE => 'MEDIUMTEXT', NOTNULL => 1, DEFAULT => "''"}); - - my @kwords; - print "Making sure 'keywords' field of table 'bugs' is empty...\n"; - $dbh->do("UPDATE bugs SET keywords = '' WHERE keywords != ''"); - print "Repopulating 'keywords' field of table 'bugs'...\n"; - my $sth = $dbh->prepare("SELECT keywords.bug_id, keyworddefs.name " . - "FROM keywords, keyworddefs " . - "WHERE keyworddefs.id = keywords.keywordid " . - "ORDER BY keywords.bug_id, keyworddefs.name"); - $sth->execute; - my @list; - my $bugid = 0; - my @row; - while (1) { - my ($b, $k) = ($sth->fetchrow_array()); - if (!defined $b || $b ne $bugid) { - if (@list) { - $dbh->do("UPDATE bugs SET keywords = " . - $dbh->quote(join(', ', @list)) . - " WHERE bug_id = $bugid"); - } - last if !$b; - $bugid = $b; - @list = (); - } - push(@list, $k); - } - } -} - # A helper for the function below. sub _write_one_longdesc { my ($id, $who, $when, $buffer) = (@_); -- cgit v1.2.3-24-g4f1b