From 948046e0dee707a2eeec362004e2e4ab594a540c Mon Sep 17 00:00:00 2001 From: "mkanat%kerio.com" <> Date: Sun, 13 Mar 2005 21:28:05 +0000 Subject: Bug 285824: whiteboard, votes, and keywords update in checksetup.pl fails to detect an already-upgraded schema Patch By Max Kanat-Alexander r=justdave, a=justdave --- checksetup.pl | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'checksetup.pl') 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. # -- cgit v1.2.3-24-g4f1b