From e8f272c6f79dc8a919911d88a5b455bc67792f64 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Sun, 8 Apr 2018 15:19:01 -0400 Subject: Bug 1427884 - Add upgrade tests from 4.2 to Harmony on mysql --- Bugzilla/DB/Schema/Mysql.pm | 2 +- Bugzilla/Group.pm | 29 ++++++++++++++++++----------- Bugzilla/Install/DB.pm | 11 ++++++++++- 3 files changed, 29 insertions(+), 13 deletions(-) (limited to 'Bugzilla') 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); } -- cgit v1.2.3-24-g4f1b