diff options
author | cyeh%bluemartini.com <> | 2001-03-01 08:33:01 +0100 |
---|---|---|
committer | cyeh%bluemartini.com <> | 2001-03-01 08:33:01 +0100 |
commit | a78a77b62422ded41030217a1015939f9092ce6d (patch) | |
tree | 69ab05c14f47878273b7999041add936b860e499 | |
parent | 66ca43f9e8c22c62a72d82ccfd61dd9efc27b14c (diff) | |
download | bugzilla-a78a77b62422ded41030217a1015939f9092ce6d.tar.gz bugzilla-a78a77b62422ded41030217a1015939f9092ce6d.tar.xz |
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.
-rwxr-xr-x | checksetup.pl | 29 |
1 files changed, 29 insertions, 0 deletions
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. |