]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Fix for Bug 399370: bugs_fulltext couldn't be converted to utf8, because it had fullt...
authormkanat%bugzilla.org <>
Tue, 25 Mar 2008 04:42:37 +0000 (04:42 +0000)
committermkanat%bugzilla.org <>
Tue, 25 Mar 2008 04:42:37 +0000 (04:42 +0000)
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> (module owner)

Bugzilla/DB/Mysql.pm

index 0bd7b7d3733543f3ef279fa0ce1270caf7d66ba9..f5e2c9becc22371cb3d03b3578252937df13f47e 100644 (file)
@@ -640,8 +640,7 @@ EOT
                     my $name = $column->{Field};
 
                     # The code below doesn't work on a field with a FULLTEXT
-                    # index. So we drop it. The upgrade code will re-create
-                    # it later.
+                    # index. So we drop it, which we'd do later anyway.
                     if ($table eq 'longdescs' && $name eq 'thetext') {
                         $self->bz_drop_index('longdescs', 
                                              'longdescs_thetext_idx');
@@ -649,6 +648,14 @@ EOT
                     if ($table eq 'bugs' && $name eq 'short_desc') {
                         $self->bz_drop_index('bugs', 'bugs_short_desc_idx');
                     }
+                    my %ft_indexes;
+                    if ($table eq 'bugs_fulltext') {
+                        %ft_indexes = $self->_bz_real_schema->get_indexes_on_column_abstract(
+                            'bugs_fulltext', $name);
+                        foreach my $index (keys %ft_indexes) {
+                            $self->bz_drop_index('bugs_fulltext', $index);
+                        }
+                    }
 
                     print "Converting $table.$name to be stored as UTF-8...\n";
                     my $col_info = 
@@ -672,6 +679,13 @@ EOT
                               $binary");
                     $self->do("ALTER TABLE $table CHANGE COLUMN $name $name 
                               $utf8");
+
+                    if ($table eq 'bugs_fulltext') {
+                        foreach my $index (keys %ft_indexes) {
+                            $self->bz_add_index('bugs_fulltext', $index,
+                                                $ft_indexes{$index});
+                        }
+                    }
                 }
             }