diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-04-08 21:19:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-08 21:19:01 +0200 |
commit | e8f272c6f79dc8a919911d88a5b455bc67792f64 (patch) | |
tree | 01f8cd3965e1db810573f65508ded737d86d82fd /Bugzilla | |
parent | 3293a1f85c9e20893e6823d1f83b667ec9ca9534 (diff) | |
download | bugzilla-e8f272c6f79dc8a919911d88a5b455bc67792f64.tar.gz bugzilla-e8f272c6f79dc8a919911d88a5b455bc67792f64.tar.xz |
Bug 1427884 - Add upgrade tests from 4.2 to Harmony on mysql
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/DB/Schema/Mysql.pm | 2 | ||||
-rw-r--r-- | Bugzilla/Group.pm | 29 | ||||
-rw-r--r-- | Bugzilla/Install/DB.pm | 11 |
3 files changed, 29 insertions, 13 deletions
diff --git a/Bugzilla/DB/Schema/Mysql.pm b/Bugzilla/DB/Schema/Mysql.pm index 0b88d94a6..5893c6a80 100644 --- a/Bugzilla/DB/Schema/Mysql.pm +++ b/Bugzilla/DB/Schema/Mysql.pm @@ -125,7 +125,7 @@ sub _get_create_table_ddl { my($self, $table) = @_; - my $charset = Bugzilla->dbh->bz_db_is_utf8 ? "CHARACTER SET utf8" : ''; + my $charset = "CHARACTER SET utf8"; my $type = grep($_ eq $table, MYISAM_TABLES) ? 'MYISAM' : 'InnoDB'; return($self->SUPER::_get_create_table_ddl($table) . " ENGINE = $type $charset"); diff --git a/Bugzilla/Group.pm b/Bugzilla/Group.pm index fe2a90c05..06491f6a0 100644 --- a/Bugzilla/Group.pm +++ b/Bugzilla/Group.pm @@ -26,17 +26,24 @@ use Scalar::Util qw(blessed); use constant IS_CONFIG => 1; -use constant DB_COLUMNS => qw( - groups.id - groups.name - groups.description - groups.isbuggroup - groups.userregexp - groups.isactive - groups.icon_url - groups.owner_user_id - groups.idle_member_removal -); +sub DB_COLUMNS { + my $class = shift; + my @columns = qw( + id + name + description + isbuggroup + userregexp + isactive + icon_url + owner_user_id + idle_member_removal + ); + my $dbh = Bugzilla->dbh; + my $table = $class->DB_TABLE; + + return map { "$table.$_" } grep { $dbh->bz_column_info($table, $_) } @columns; +} use constant DB_TABLE => 'groups'; diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm index 2c8a22448..0d63f68b9 100644 --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -3895,7 +3895,16 @@ sub _migrate_group_owners { my $dbh = Bugzilla->dbh; return if $dbh->bz_column_info('groups', 'owner_user_id'); $dbh->bz_add_column('groups', 'owner_user_id', {TYPE => 'INT3'}); - my $nobody = Bugzilla::User->check(Bugzilla->params->{'nobody_user'}); + my $nobody = Bugzilla::User->new({ name => Bugzilla->params->{'nobody_user'}, cache => 1 }); + unless ($nobody) { + $nobody = Bugzilla::User->create( + { + login_name => Bugzilla->params->{'nobody_user'}, + realname => 'Nobody (ok to assign bugs to)', + cryptpassword => '*', + } + ); + } $dbh->do('UPDATE groups SET owner_user_id = ?', undef, $nobody->id); } |