From a78a77b62422ded41030217a1015939f9092ce6d Mon Sep 17 00:00:00 2001 From: "cyeh%bluemartini.com" <> Date: Thu, 1 Mar 2001 07:33:01 +0000 Subject: fix for 61637: Code bit for upgrading from 2.5 based on patch submitted by ehanson@talkware.net (Eric Hanson) support for changes comments table to longdescs, but only if comments table exists. --- checksetup.pl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/checksetup.pl b/checksetup.pl index 2be26451a..a23ba6a50 100755 --- a/checksetup.pl +++ b/checksetup.pl @@ -1446,6 +1446,22 @@ sub DropField ($$) DROP COLUMN $field"); } +# this uses a mysql specific command. +sub TableExists ($) +{ + my ($table) = @_; + my @tables; + my $dbtable; + my $exists = 0; + my $sth = $dbh->prepare("SHOW TABLES"); + $sth->execute; + while ( ($dbtable) = $sth->fetchrow_array ) { + if ($dbtable eq $table) { + $exists = 1; + } + } + return $exists; +} $::regenerateshadow = 0; @@ -2122,6 +2138,19 @@ if (!GetFieldDef('profiles', 'emailflags')) { AddField('profiles', 'emailflags', 'mediumtext'); } +# http://bugzilla.mozilla.org/show_bug.cgi?id=61637 +# upgrade older versions of bugzilla that have the old comments table +if (&TableExists('comments')) { + RenameField ('comments', 'when', 'bug_when'); + ChangeFieldType('comments', 'bug_id', 'mediumint not null'); + ChangeFieldType('comments', 'who', 'mediumint not null'); + ChangeFieldType('comments', 'bug_when', 'datetime not null'); + RenameField('comments','comment','thetext'); + # Here we rename comments to longdescs + $dbh->do("DROP TABLE longdescs"); + $dbh->do("ALTER TABLE comments RENAME longdescs"); +} + # # 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