summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbbaetz%acm.org <>2003-04-27 16:20:36 +0200
committerbbaetz%acm.org <>2003-04-27 16:20:36 +0200
commit8449ddc1397a699e8473ee657b18e1ed6928f4bb (patch)
tree5a37c734d6bc56f529d0dd81537de76a0c0fd87e
parentf016a7980404372d9855215a5107968beb3c82f4 (diff)
downloadbugzilla-8449ddc1397a699e8473ee657b18e1ed6928f4bb.tar.gz
bugzilla-8449ddc1397a699e8473ee657b18e1ed6928f4bb.tar.xz
Bug 180086 - Rename 'count' column in votes tables
patch by bugzilla@chimpychompy.org (GavinS) r=bbaetz,justdave a=justdave
-rwxr-xr-xBug.pm2
-rwxr-xr-xBugzilla/Bug.pm2
-rwxr-xr-xchecksetup.pl24
-rwxr-xr-xeditproducts.cgi4
-rw-r--r--globals.pl6
-rwxr-xr-xsanitycheck.cgi4
-rwxr-xr-xvotes.cgi14
7 files changed, 33 insertions, 23 deletions
diff --git a/Bug.pm b/Bug.pm
index 9e8e44c55..750fd8186 100755
--- a/Bug.pm
+++ b/Bug.pm
@@ -140,7 +140,7 @@ sub initBug {
reporter, bug_file_loc, short_desc, target_milestone,
qa_contact, status_whiteboard,
DATE_FORMAT(creation_ts,'%Y.%m.%d %H:%i'),
- delta_ts, sum(votes.count),
+ delta_ts, sum(votes.vote_count),
reporter_accessible, cclist_accessible,
estimated_time, remaining_time
from bugs left join votes using(bug_id),
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 9e8e44c55..750fd8186 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -140,7 +140,7 @@ sub initBug {
reporter, bug_file_loc, short_desc, target_milestone,
qa_contact, status_whiteboard,
DATE_FORMAT(creation_ts,'%Y.%m.%d %H:%i'),
- delta_ts, sum(votes.count),
+ delta_ts, sum(votes.vote_count),
reporter_accessible, cclist_accessible,
estimated_time, remaining_time
from bugs left join votes using(bug_id),
diff --git a/checksetup.pl b/checksetup.pl
index f3228e804..d9c2ce04d 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -1356,7 +1356,7 @@ print "\n" unless $silent;
# safer than the make*.sh shell scripts used to be, because they won't
# delete existing tables.
#
-# If you want intentionally do this, yon can always drop a table and re-run
+# If you want to intentionally do this, you can always drop a table and re-run
# checksetup, e.g. like this:
#
# $ mysql bugs
@@ -1659,7 +1659,7 @@ $table{versions} =
$table{votes} =
'who mediumint not null,
bug_id mediumint not null,
- count smallint not null,
+ vote_count smallint not null,
index(who),
index(bug_id)';
@@ -3869,11 +3869,21 @@ if (TableExists('shadowlog')) {
$dbh->do("DROP TABLE shadowlog");
}
-# 2003-04-24 - myk@mozilla.org/bbaetz@acm.org, bug 201018
-# Force all cached groups to be updated at login, due to security
-# At the next schema change, this should be moved inside that block so that the
-# update doesn't happen on every run
-$dbh->do("UPDATE profiles SET refreshed_when='1900-01-01 00:00:00'");
+# 2003-04-XX - bugzilla@chimpychompy.org (GavinS)
+#
+# Bug 180086 (http://bugzilla.mozilla.org/show_bug.cgi?id=180086)
+#
+# Renaming the 'count' column in the votes table because Sybase doesn't
+# like it
+if (GetFieldDef('votes', 'count')) {
+ # 2003-04-24 - myk@mozilla.org/bbaetz@acm.org, bug 201018
+ # Force all cached groups to be updated at login, due to security bug
+ # Do this here, inside the next schema change block, so that it doesn't
+ # get invalidated on every checksetup run.
+ $dbh->do("UPDATE profiles SET refreshed_when='1900-01-01 00:00:00'");
+
+ RenameField ('votes', 'count', 'vote_count');
+}
#
# Final checks...
diff --git a/editproducts.cgi b/editproducts.cgi
index 9592c02ad..147fbbc38 100755
--- a/editproducts.cgi
+++ b/editproducts.cgi
@@ -1170,7 +1170,7 @@ if ($action eq 'update') {
"FROM votes, bugs " .
"WHERE bugs.bug_id = votes.bug_id " .
" AND bugs.product_id = $product_id " .
- " AND votes.count > $maxvotesperbug");
+ " AND votes.vote_count > $maxvotesperbug");
my @list;
while (MoreSQLData()) {
my ($who, $id) = (FetchSQLData());
@@ -1183,7 +1183,7 @@ if ($action eq 'update') {
print qq{<br>Removed votes for bug <A HREF="show_bug.cgi?id=$id">$id</A> from $name\n};
}
}
- SendSQL("SELECT votes.who, votes.count FROM votes, bugs " .
+ SendSQL("SELECT votes.who, votes.vote_count FROM votes, bugs " .
"WHERE bugs.bug_id = votes.bug_id " .
" AND bugs.product_id = $product_id");
my %counts;
diff --git a/globals.pl b/globals.pl
index 4caaa3f84..88c8720e8 100644
--- a/globals.pl
+++ b/globals.pl
@@ -1355,7 +1355,7 @@ sub RemoveVotes {
if ($who) {
$whopart = " AND votes.who = $who";
}
- SendSQL("SELECT profiles.login_name, profiles.userid, votes.count, " .
+ SendSQL("SELECT profiles.login_name, profiles.userid, votes.vote_count, " .
"products.votesperuser, products.maxvotesperbug " .
"FROM profiles " .
"LEFT JOIN votes ON profiles.userid = votes.who " .
@@ -1393,7 +1393,7 @@ sub RemoveVotes {
my $newvotestext;
if ($newvotes) {
- SendSQL("UPDATE votes SET count = $newvotes " .
+ SendSQL("UPDATE votes SET vote_count = $newvotes " .
"WHERE bug_id = $id AND who = $userid");
$s = $newvotes == 1 ? "" : "s";
$newvotestext = "You still have $newvotes vote$s on this bug."
@@ -1436,7 +1436,7 @@ sub RemoveVotes {
close SENDMAIL;
}
}
- SendSQL("SELECT SUM(count) FROM votes WHERE bug_id = $id");
+ SendSQL("SELECT SUM(vote_count) FROM votes WHERE bug_id = $id");
my $v = FetchOneColumn();
$v ||= 0;
SendSQL("UPDATE bugs SET votes = $v, delta_ts = delta_ts " .
diff --git a/sanitycheck.cgi b/sanitycheck.cgi
index 16a123967..98734e5b0 100755
--- a/sanitycheck.cgi
+++ b/sanitycheck.cgi
@@ -82,7 +82,7 @@ if (exists $::FORM{'rebuildvotecache'}) {
Status("OK, now rebuilding vote cache.");
SendSQL("lock tables bugs write, votes read");
SendSQL("update bugs set votes = 0, delta_ts=delta_ts");
- SendSQL("select bug_id, sum(count) from votes group by bug_id");
+ SendSQL("select bug_id, sum(vote_count) from votes group by bug_id");
my %votes;
while (@row = FetchSQLData()) {
my ($id, $v) = (@row);
@@ -433,7 +433,7 @@ while (@row = FetchSQLData()) {
}
Status("Checking cached vote counts");
-SendSQL("select bug_id, sum(count) from votes group by bug_id");
+SendSQL("select bug_id, sum(vote_count) from votes group by bug_id");
while (@row = FetchSQLData()) {
my ($id, $v) = (@row);
diff --git a/votes.cgi b/votes.cgi
index 6b35fc027..e386d5422 100755
--- a/votes.cgi
+++ b/votes.cgi
@@ -92,7 +92,7 @@ sub show_bug {
my $total = 0;
my @users;
- SendSQL("SELECT profiles.login_name, votes.who, votes.count
+ SendSQL("SELECT profiles.login_name, votes.who, votes.vote_count
FROM votes, profiles
WHERE votes.bug_id = $bug_id
AND profiles.userid = votes.who");
@@ -137,10 +137,10 @@ sub show_user {
if ($canedit && $bug_id) {
# Make sure there is an entry for this bug
# in the vote table, just so that things display right.
- SendSQL("SELECT votes.count FROM votes
+ SendSQL("SELECT votes.vote_count FROM votes
WHERE votes.bug_id = $bug_id AND votes.who = $who");
if (!FetchOneColumn()) {
- SendSQL("INSERT INTO votes (who, bug_id, count)
+ SendSQL("INSERT INTO votes (who, bug_id, vote_count)
VALUES ($who, $bug_id, 0)");
}
}
@@ -167,7 +167,7 @@ sub show_user {
my $total = 0;
my $onevoteonly = 0;
- SendSQL("SELECT votes.bug_id, votes.count, bugs.short_desc,
+ SendSQL("SELECT votes.bug_id, votes.vote_count, bugs.short_desc,
bugs.bug_status
FROM votes, bugs, products
WHERE votes.who = $who
@@ -207,7 +207,7 @@ sub show_user {
}
}
- SendSQL("DELETE FROM votes WHERE count <= 0");
+ SendSQL("DELETE FROM votes WHERE vote_count <= 0");
SendSQL("UNLOCK TABLES");
$vars->{'voting_user'} = { "login" => $name };
@@ -318,7 +318,7 @@ sub record_votes {
# Insert the new values in their place
foreach my $id (@buglist) {
if ($::FORM{$id} > 0) {
- SendSQL("INSERT INTO votes (who, bug_id, count)
+ SendSQL("INSERT INTO votes (who, bug_id, vote_count)
VALUES ($who, $id, $::FORM{$id})");
}
@@ -327,7 +327,7 @@ sub record_votes {
# Update the cached values in the bugs table
foreach my $id (keys %affected) {
- SendSQL("SELECT sum(count) FROM votes WHERE bug_id = $id");
+ SendSQL("SELECT sum(vote_count) FROM votes WHERE bug_id = $id");
my $v = FetchOneColumn();
$v ||= 0;
SendSQL("UPDATE bugs SET votes = $v, delta_ts=delta_ts