diff options
author | mkanat%bugzilla.org <> | 2008-03-25 05:42:37 +0100 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2008-03-25 05:42:37 +0100 |
commit | 26f4337cd484e3c9553d0def4a4fc58ecf8cdc6a (patch) | |
tree | 0654ac87d816b5fa1b2fd7a884320bcda98ebae4 /Bugzilla/DB | |
parent | dc0d63e12a58052775eb2729c57ba1a4bfa56c9c (diff) | |
download | bugzilla-26f4337cd484e3c9553d0def4a4fc58ecf8cdc6a.tar.gz bugzilla-26f4337cd484e3c9553d0def4a4fc58ecf8cdc6a.tar.xz |
Fix for Bug 399370: bugs_fulltext couldn't be converted to utf8, because it had fulltext indexes on it.
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> (module owner)
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r-- | Bugzilla/DB/Mysql.pm | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index 0bd7b7d37..f5e2c9bec 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -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}); + } + } } } |