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),
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),
# 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
$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)';
$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...
"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());
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;
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 " .
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."
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 " .
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);
}
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);
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");
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)");
}
}
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
}
}
- SendSQL("DELETE FROM votes WHERE count <= 0");
+ SendSQL("DELETE FROM votes WHERE vote_count <= 0");
SendSQL("UNLOCK TABLES");
$vars->{'voting_user'} = { "login" => $name };
# 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})");
}
# 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