Commit a78a77b6 authored by cyeh%bluemartini.com's avatar cyeh%bluemartini.com

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.
parent 66ca43f9
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment