aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2006-07-17 06:22:32 +0000
committerlpsolit%gmail.com <>2006-07-17 06:22:32 +0000
commit6a688141978ccd79300218f48cce9a42e1ad1a91 (patch)
treed36348c98eae0300a20ce80df04de331ce9cbba9 /checksetup.pl
parentBug 95923: Don't let users change fields they aren't allowed to change - Patc... (diff)
downloadbugzilla-6a688141978ccd79300218f48cce9a42e1ad1a91.tar.gz
bugzilla-6a688141978ccd79300218f48cce9a42e1ad1a91.tar.bz2
bugzilla-6a688141978ccd79300218f48cce9a42e1ad1a91.zip
Bug 277377: Classifications should support sort keys - Patch by Olav Vitters <bugzilla-mozilla@bkor.dhs.org> r=LpSolit a=justdave
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-xchecksetup.pl19
1 files changed, 19 insertions, 0 deletions
diff --git a/checksetup.pl b/checksetup.pl
index 9033666ee..b0a2b2962 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -4229,6 +4229,25 @@ if ($dbh->bz_column_info("namedqueries", "linkinfooter")) {
$dbh->bz_drop_column("namedqueries", "linkinfooter");
}
+# 2006-07-07 olav@bkor.dhs.org - Bug 277377
+# Add a sortkey to the classifications
+if (!$dbh->bz_column_info('classifications', 'sortkey')) {
+ print "Adding sortkey column to classifications table...\n" unless $silent;
+
+ $dbh->bz_add_column('classifications', 'sortkey',
+ {TYPE => 'INT2', NOTNULL => 1, DEFAULT => 0});
+
+ my $class_ids = $dbh->selectcol_arrayref('SELECT id FROM classifications ' .
+ 'ORDER BY name');
+ my $sth = $dbh->prepare('UPDATE classifications SET sortkey = ? ' .
+ 'WHERE id = ?');
+ my $sortkey = 0;
+ foreach my $class_id (@$class_ids) {
+ $sth->execute($sortkey, $class_id);
+ $sortkey += 100;
+ }
+}
+
# If you had to change the --TABLE-- definition in any way, then add your
# differential change code *** A B O V E *** this comment.
#