diff options
author | terry%mozilla.org <> | 2000-03-22 01:47:04 +0100 |
---|---|---|
committer | terry%mozilla.org <> | 2000-03-22 01:47:04 +0100 |
commit | 6b2eec91f21d4aa28e68f18435c8636f377a4b2a (patch) | |
tree | 855b795f02d39a7d676949572d872d15bf1e7901 /checksetup.pl | |
parent | c7ae4f650a612ccf62f68c9894f5a6cd62f464b0 (diff) | |
download | bugzilla-6b2eec91f21d4aa28e68f18435c8636f377a4b2a.tar.gz bugzilla-6b2eec91f21d4aa28e68f18435c8636f377a4b2a.tar.xz |
Patch by "Matt Masson" <matthew@zeroknowledge.com> -- allow definition
of different target milestones by product.
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-x | checksetup.pl | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/checksetup.pl b/checksetup.pl index 685267f97..e31d85499 100755 --- a/checksetup.pl +++ b/checksetup.pl @@ -752,6 +752,12 @@ $table{keyworddefs} = unique(name)'; +$table{milestones} = + 'value varchar(190) not null, + product varchar(64) not null, + sortkey smallint not null, + unique (product, value)'; + $table{shadowlog} = 'id int not null auto_increment primary key, ts timestamp, @@ -1493,6 +1499,44 @@ AddField('products', 'votestoconfirm', 'smallint not null'); AddField('profiles', 'blessgroupset', 'bigint not null'); +# 2000-03-21 Adding a table for target milestones to +# database - matthew@zeroknowledge.com + +$sth = $dbh->prepare("SELECT count(*) from milestones"); +$sth->execute(); +if (!($sth->fetchrow_arrayref()->[0])) { + print "Replacing blank milestones...\n"; + $dbh->do("UPDATE bugs SET target_milestone = '---', delta_ts=delta_ts WHERE target_milestone = ' '"); + +# Populate milestone table with all exisiting values in database + $sth = $dbh->prepare("SELECT DISTINCT target_milestone, product FROM bugs"); + $sth->execute(); + + print "Populating milestones table...\n"; + + my $value; + my $product; + while(($value, $product) = $sth->fetchrow_array()) + { + # check if the value already exists + my $sortkey = substr($value, 1); + if ($sortkey !~ /^\d+$/) { + $sortkey = 0; + } else { + $sortkey *= 10; + } + $value = $dbh->quote($value); + $product = $dbh->quote($product); + my $s2 = $dbh->prepare("SELECT value FROM milestones WHERE value = $value AND product = $product"); + $s2->execute(); + + if(!$s2->fetchrow_array()) + { + $dbh->do("INSERT INTO milestones(value, product, sortkey) VALUES($value, $product, $sortkey)"); + } + } +} + # # If you had to change the --TABLE-- definition in any way, then add your # differential change code *** A B O V E *** this comment. |