From e11e9b4ace1e1e3908b93dce75568a1af0ab3995 Mon Sep 17 00:00:00 2001 From: "terry%mozilla.org" Date: Sat, 22 Jan 2000 21:43:30 +0000 Subject: [PATCH] AACK! checksetup.pl was stomping all over the new fielddefs table if it got run more than once. This checkin fixes that, and also changes the DumpBugActivity() routine to give me enough information to hopefully repair the damaged mozilla.org database... git-svn-id: svn://10.0.0.236/trunk@58412 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/CGI.pl | 8 +++++--- mozilla/webtools/bugzilla/checksetup.pl | 13 +++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/mozilla/webtools/bugzilla/CGI.pl b/mozilla/webtools/bugzilla/CGI.pl index 4ad0064f3e2..8770da7489d 100644 --- a/mozilla/webtools/bugzilla/CGI.pl +++ b/mozilla/webtools/bugzilla/CGI.pl @@ -778,12 +778,14 @@ sub DumpBugActivity { $datepart = "and bugs_activity.bug_when >= $starttime"; } my $query = " - SELECT fielddefs.name, bugs_activity.bug_when, + SELECT IFNULL(fielddefs.name, bugs_activity.fieldid), + bugs_activity.bug_when, bugs_activity.oldvalue, bugs_activity.newvalue, profiles.login_name - FROM bugs_activity,profiles,fielddefs + FROM bugs_activity LEFT JOIN fielddefs ON + bugs_activity.fieldid = fielddefs.fieldid, + profiles WHERE bugs_activity.bug_id = $id $datepart - AND fielddefs.fieldid = bugs_activity.fieldid AND profiles.userid = bugs_activity.who ORDER BY bugs_activity.bug_when"; diff --git a/mozilla/webtools/bugzilla/checksetup.pl b/mozilla/webtools/bugzilla/checksetup.pl index 02e629805b0..6adbc42f48f 100755 --- a/mozilla/webtools/bugzilla/checksetup.pl +++ b/mozilla/webtools/bugzilla/checksetup.pl @@ -851,9 +851,17 @@ sub AddFDef ($$$) { $name = $dbh->quote($name); $description = $dbh->quote($description); + my $sth = $dbh->prepare("SELECT fieldid FROM fielddefs " . + "WHERE name = $name"); + $sth->execute(); + my ($fieldid) = ($sth->fetchrow_array()); + if (!$fieldid) { + $fieldid = 'NULL'; + } + $dbh->do("REPLACE INTO fielddefs " . - "(name, description, mailhead, sortkey) VALUES " . - "($name, $description, $mailhead, $headernum)"); + "(fieldid, name, description, mailhead, sortkey) VALUES " . + "($fieldid, $name, $description, $mailhead, $headernum)"); $headernum++; } @@ -876,6 +884,7 @@ AddFDef("cc", "CC", 0); AddFDef("dependson", "BugsThisDependsOn", 0); AddFDef("blocked", "OtherBugsDependingOnThis", 0); AddFDef("target_milestone", "Target Milestone", 0); +AddFDef("stupidtest", "Stupidtest", 0);