diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-07-13 00:20:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-13 00:20:25 +0200 |
commit | a671f4ebe0f80686d9d98d51c754a07f4bb68d31 (patch) | |
tree | ddec19fe13f75475c2c7c86b212134a93f6d33ad /Bugzilla/DB/Schema | |
parent | e671c6b2bd6ef20f357ed710377258a730e268a3 (diff) | |
download | bugzilla-a671f4ebe0f80686d9d98d51c754a07f4bb68d31.tar.gz bugzilla-a671f4ebe0f80686d9d98d51c754a07f4bb68d31.tar.xz |
Bug 1328659 - Add support for utf8=utf8mb4 (switches to dynamic/compressed row format, and changes charset to utf8mb4)
Diffstat (limited to 'Bugzilla/DB/Schema')
-rw-r--r-- | Bugzilla/DB/Schema/Mysql.pm | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/Bugzilla/DB/Schema/Mysql.pm b/Bugzilla/DB/Schema/Mysql.pm index 0b88d94a6..79814140a 100644 --- a/Bugzilla/DB/Schema/Mysql.pm +++ b/Bugzilla/DB/Schema/Mysql.pm @@ -76,8 +76,6 @@ use constant REVERSE_MAPPING => { # as in their db-specific version, so no reverse mapping is needed. }; -use constant MYISAM_TABLES => qw(); - #------------------------------------------------------------------------------ sub _initialize { @@ -120,16 +118,18 @@ sub _initialize { } #eosub--_initialize #------------------------------------------------------------------------------ sub _get_create_table_ddl { - # Extend superclass method to specify the MYISAM storage engine. # Returns a "create table" SQL statement. - my($self, $table) = @_; - - my $charset = Bugzilla->dbh->bz_db_is_utf8 ? "CHARACTER SET utf8" : ''; - my $type = grep($_ eq $table, MYISAM_TABLES) ? 'MYISAM' : 'InnoDB'; - return($self->SUPER::_get_create_table_ddl($table) - . " ENGINE = $type $charset"); - + my $charset = Bugzilla::DB::Mysql->utf8_charset; + my $collate = Bugzilla::DB::Mysql->utf8_collate; + my $row_format = Bugzilla::DB::Mysql->default_row_format($table); + my @parts = ( + $self->SUPER::_get_create_table_ddl($table), + 'ENGINE = InnoDB', + "CHARACTER SET $charset COLLATE $collate", + "ROW_FORMAT=$row_format", + ); + return join(' ', @parts); } #eosub--_get_create_table_ddl #------------------------------------------------------------------------------ sub _get_create_index_ddl { @@ -153,10 +153,9 @@ sub get_create_database_sql { my ($self, $name) = @_; # We only create as utf8 if we have no params (meaning we're doing # a new installation) or if the utf8 param is on. - my $create_utf8 = Bugzilla->params->{'utf8'} - || !defined Bugzilla->params->{'utf8'}; - my $charset = $create_utf8 ? "CHARACTER SET utf8" : ''; - return ("CREATE DATABASE $name $charset"); + my $charset = Bugzilla::DB::Mysql->utf8_charset; + my $collate = Bugzilla::DB::Mysql->utf8_collate; + return ("CREATE DATABASE $name CHARACTER SET $charset COLLATE $collate"); } # MySQL has a simpler ALTER TABLE syntax than ANSI. |