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 /extensions/TagNewUsers/Extension.pm | |
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 'extensions/TagNewUsers/Extension.pm')
-rw-r--r-- | extensions/TagNewUsers/Extension.pm | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/extensions/TagNewUsers/Extension.pm b/extensions/TagNewUsers/Extension.pm index b94873979..1810f204f 100644 --- a/extensions/TagNewUsers/Extension.pm +++ b/extensions/TagNewUsers/Extension.pm @@ -123,7 +123,9 @@ sub object_columns { my ($self, $args) = @_; my ($class, $columns) = @$args{qw(class columns)}; if ($class->isa('Bugzilla::User')) { - push(@$columns, qw(comment_count creation_ts first_patch_bug_id)); + my $dbh = Bugzilla->dbh; + my @new_columns = qw(comment_count creation_ts first_patch_bug_id); + push @$columns, grep { $dbh->bz_column_info($class->DB_TABLE, $_) } @new_columns; } } @@ -131,9 +133,14 @@ sub object_before_create { my ($self, $args) = @_; my ($class, $params) = @$args{qw(class params)}; if ($class->isa('Bugzilla::User')) { - my ($timestamp) = Bugzilla->dbh->selectrow_array("SELECT NOW()"); - $params->{comment_count} = 0; - $params->{creation_ts} = $timestamp; + my $dbh = Bugzilla->dbh; + my ($timestamp) = $dbh->selectrow_array("SELECT NOW()"); + if ($dbh->bz_column_info($class->DB_TABLE, 'comment_count')) { + $params->{comment_count} = 0; + } + if ($dbh->bz_column_info($class->DB_TABLE, 'creation_ts')) { + $params->{creation_ts} = $timestamp; + } } elsif ($class->isa('Bugzilla::Attachment')) { if ($params->{ispatch} && !Bugzilla->user->first_patch_bug_id) { Bugzilla->user->first_patch_bug_id($params->{bug}->id); |