summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Install
diff options
context:
space:
mode:
authorTiago Mello <timello@gmail.com>2011-02-11 02:31:28 +0100
committerTiago Mello <timello@gmail.com>2011-02-11 02:31:28 +0100
commitf0b6242097e487198de559d39d4169a2a0a4d8e7 (patch)
tree8e6dce90308e188c2d3656859fa319b2b8544221 /Bugzilla/Install
parenta744c531a46bdd18aed3cc89ed0770a791d27475 (diff)
downloadbugzilla-f0b6242097e487198de559d39d4169a2a0a4d8e7.tar.gz
bugzilla-f0b6242097e487198de559d39d4169a2a0a4d8e7.tar.xz
Bug 620827: Refactor remove see also to use remove_from_db instead.
r/a=mkanat
Diffstat (limited to 'Bugzilla/Install')
-rw-r--r--Bugzilla/Install/DB.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index ea1f1de1c..7f32166c9 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -28,6 +28,7 @@ use Bugzilla::Install ();
use Bugzilla::Install::Util qw(indicate_progress install_string);
use Bugzilla::Util;
use Bugzilla::Series;
+use Bugzilla::BugUrl;
use Date::Parse;
use Date::Format;
@@ -648,6 +649,8 @@ sub update_table_definitions {
# 2011-01-29 LpSolit@gmail.com - Bug 616185
_migrate_user_tags();
+ _populate_bug_see_also_class();
+
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
@@ -3542,6 +3545,29 @@ sub _migrate_user_tags {
$dbh->bz_drop_column('namedqueries', 'query_type');
}
+sub _populate_bug_see_also_class {
+ my $dbh = Bugzilla->dbh;
+
+ return if $dbh->bz_column_info('bug_see_also', 'class');
+
+ $dbh->bz_add_column('bug_see_also', 'class',
+ {TYPE => 'varchar(64)', NOTNULL => 1}, '');
+
+ my $result = $dbh->selectall_arrayref(
+ "SELECT id, value FROM bug_see_also");
+
+ my $update_sth =
+ $dbh->prepare("UPDATE bug_see_also SET class = ? WHERE id = ?");
+
+ $dbh->bz_start_transaction();
+ foreach my $see_also (@$result) {
+ my ($id, $value) = @$see_also;
+ my $class = Bugzilla::BugUrl->class_for($value);
+ $update_sth->execute($class, $id);
+ }
+ $dbh->bz_commit_transaction();
+}
+
1;
__END__