зеркало из https://github.com/mozilla/gecko-dev.git
Bug 180086 - Rename 'count' column in votes tables
patch by bugzilla@chimpychompy.org (GavinS) r=bbaetz,justdave a=justdave
This commit is contained in:
Родитель
f36a56c3bb
Коммит
30357668b4
|
@ -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),
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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...
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 " .
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче