diff options
author | mkanat%bugzilla.org <> | 2009-08-06 14:53:46 +0000 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-08-06 14:53:46 +0000 |
commit | 5539de9f747ef48c0ef2bd416d5008bb7a341cfa (patch) | |
tree | 5ade6b48be008e2db1037e7031ff89d5e92c7972 /Bugzilla/DB/Mysql.pm | |
parent | 8dc4b874a314a9ff4b32d3223fe481ef32a6a475 (diff) | |
download | bugs-5539de9f747ef48c0ef2bd416d5008bb7a341cfa.tar bugs-5539de9f747ef48c0ef2bd416d5008bb7a341cfa.tar.gz bugs-5539de9f747ef48c0ef2bd416d5008bb7a341cfa.tar.bz2 bugs-5539de9f747ef48c0ef2bd416d5008bb7a341cfa.tar.xz bugs-5539de9f747ef48c0ef2bd416d5008bb7a341cfa.zip |
Bug 508181: UTF-8 table conversion was failing when there were FKs on the column or on related columns
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=mkanat
Diffstat (limited to 'Bugzilla/DB/Mysql.pm')
-rw-r--r-- | Bugzilla/DB/Mysql.pm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index 881ff28b8..970bacfae 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -713,6 +713,7 @@ EOT print "Converting table storage format to UTF-8. This may take a", " while.\n"; + my @dropped_fks; foreach my $table ($self->bz_table_list_real) { my $info_sth = $self->prepare("SHOW FULL COLUMNS FROM $table"); $info_sth->execute(); @@ -746,13 +747,15 @@ EOT } } + my $dropped = $self->bz_drop_related_fks($table, $name); + push(@dropped_fks, @$dropped); + print "Converting $table.$name to be stored as UTF-8...\n"; my $col_info = $self->bz_column_info_real($table, $name); # CHANGE COLUMN doesn't take PRIMARY KEY delete $col_info->{PRIMARYKEY}; - my $sql_def = $self->_bz_schema->get_type_ddl($col_info); # We don't want MySQL to actually try to *convert* # from our current charset to UTF-8, we just want to @@ -779,7 +782,12 @@ EOT } $self->do("ALTER TABLE $table DEFAULT CHARACTER SET utf8"); + } # foreach my $table (@tables) + + foreach my $fk_args (@dropped_fks) { + $self->bz_add_fk(@$fk_args); + } } # Sometimes you can have a situation where all the tables are utf8, |