summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjustdave%bugzilla.org <>2004-07-04 12:34:04 +0200
committerjustdave%bugzilla.org <>2004-07-04 12:34:04 +0200
commit207f5584107ac5a8dc9cdc79b09d5a88eaf06b6a (patch)
tree60dc8ba65b859760d3744b5f03acce1906af63ef
parent3c436394d0083ed29e9381aa48b467a0ae99bc11 (diff)
downloadbugzilla-207f5584107ac5a8dc9cdc79b09d5a88eaf06b6a.tar.gz
bugzilla-207f5584107ac5a8dc9cdc79b09d5a88eaf06b6a.tar.xz
Bug 245101: Fixes non-fatal warnings about the "attachstatusdefs" table not existing during an upgrade from 2.14.x or older without going through 2.16.x in between.
r=joel, a=justdave
-rwxr-xr-xchecksetup.pl12
1 files changed, 9 insertions, 3 deletions
diff --git a/checksetup.pl b/checksetup.pl
index 2eeeebb32..684a8ca7e 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -3272,7 +3272,13 @@ if (GetFieldDef("products", "product")) {
AddField("versions", "product_id", "smallint not null");
AddField("milestones", "product_id", "smallint not null");
AddField("bugs", "product_id", "smallint not null");
- AddField("attachstatusdefs", "product_id", "smallint not null");
+ # The attachstatusdefs table was added in version 2.15, but removed again
+ # in early 2.17. If it exists now, we still need to perform this change
+ # with product_id because the code further down which converts the
+ # attachment statuses to flags depends on it. But we need to avoid this
+ # if the user is upgrading from 2.14 or earlier (because it won't be
+ # there to convert).
+ AddField("attachstatusdefs", "product_id", "smallint not null") if TableExists("attachstatusdefs");
my %products;
my $sth = $dbh->prepare("SELECT id, product FROM products");
$sth->execute;
@@ -3292,7 +3298,7 @@ if (GetFieldDef("products", "product")) {
$dbh->do("UPDATE bugs SET product_id = $product_id, delta_ts=delta_ts " .
"WHERE product = " . $dbh->quote($product));
$dbh->do("UPDATE attachstatusdefs SET product_id = $product_id " .
- "WHERE product = " . $dbh->quote($product));
+ "WHERE product = " . $dbh->quote($product)) if TableExists("attachstatusdefs");
}
print "Updating the database to use component IDs.\n";
@@ -3330,7 +3336,7 @@ if (GetFieldDef("products", "product")) {
DropField("milestones", "product");
DropField("bugs", "product");
DropField("bugs", "component");
- DropField("attachstatusdefs", "product");
+ DropField("attachstatusdefs", "product") if TableExists("attachstatusdefs");
RenameField("products", "product", "name");
ChangeFieldType("products", "name", "varchar(64) not null");
RenameField("components", "value", "name");