summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-03-13 22:28:05 +0100
committermkanat%kerio.com <>2005-03-13 22:28:05 +0100
commit948046e0dee707a2eeec362004e2e4ab594a540c (patch)
tree673e1f3a12b349374b793e106c1a56263ac2aa49
parenta9a03e405b9e37fa37e1e07b086e510e746ef71b (diff)
downloadbugzilla-948046e0dee707a2eeec362004e2e4ab594a540c.tar.gz
bugzilla-948046e0dee707a2eeec362004e2e4ab594a540c.tar.xz
Bug 285824: whiteboard, votes, and keywords update in checksetup.pl fails to detect an already-upgraded schema
Patch By Max Kanat-Alexander <mkanat@kerio.com> r=justdave, a=justdave
-rwxr-xr-xchecksetup.pl23
1 files changed, 15 insertions, 8 deletions
diff --git a/checksetup.pl b/checksetup.pl
index f93b3349a..d9e082ba7 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -3837,22 +3837,29 @@ if (!defined $dbh->bz_get_index_def('bugs_activity','who')) {
$dbh->do('ALTER TABLE bugs_activity ADD INDEX (who)');
}
-$dbh->bz_change_field_type('bugs', 'status_whiteboard',
- q{mediumtext not null default ''});
-$dbh->bz_change_field_type('bugs', 'keywords',
- q{mediumtext not null default ''});
-$dbh->bz_change_field_type('bugs', 'votes', 'mediumint not null default 0');
+# This lastdiffed change and these default changes are unrelated,
+# but in order for MySQL to successfully run these default changes only once,
+# they have to be inside this block.
+# If bugs.lastdiffed is NOT NULL...
+if(!$dbh->bz_get_field_def('bugs', 'lastdiffed')->[2]) {
+ # Add defaults for some fields that should have them but didn't.
+ $dbh->bz_change_field_type('bugs', 'status_whiteboard',
+ q{mediumtext not null default ''});
+ $dbh->bz_change_field_type('bugs', 'keywords',
+ q{mediumtext not null default ''});
+ $dbh->bz_change_field_type('bugs', 'votes',
+ 'mediumint not null default 0');
+ # And change lastdiffed to NULL
+ $dbh->bz_change_field_type('bugs', 'lastdiffed', 'datetime');
+}
# 2005-03-03 travis@sedsystems.ca -- Bug 41972
add_setting ("display_quips", {"on" => 1, "off" => 2 }, "on" );
-$dbh->bz_change_field_type('bugs', 'lastdiffed', 'datetime');
} # END LEGACY CHECKS
-
-
# If you had to change the --TABLE-- definition in any way, then add your
# differential change code *** A B O V E *** this comment.
#