From 6a688141978ccd79300218f48cce9a42e1ad1a91 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Mon, 17 Jul 2006 06:22:32 +0000 Subject: Bug 277377: Classifications should support sort keys - Patch by Olav Vitters r=LpSolit a=justdave --- checksetup.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'checksetup.pl') 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. # -- cgit v1.2.3-24-g4f1b