]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 285824: whiteboard, votes, and keywords update in checksetup.pl fails to detect...
authormkanat%kerio.com <>
Sun, 13 Mar 2005 21:28:05 +0000 (21:28 +0000)
committermkanat%kerio.com <>
Sun, 13 Mar 2005 21:28:05 +0000 (21:28 +0000)
Patch By Max Kanat-Alexander <mkanat@kerio.com> r=justdave, a=justdave

checksetup.pl

index f93b3349a74a91964798483653d048f3a7a58849..d9e082ba7f8bc2f4410d9a825f61523cf73241e2 100755 (executable)
@@ -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.
 #