summaryrefslogtreecommitdiffstats
path: root/extensions/ComponentWatching
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-04-08 19:41:26 +0200
committerDavid Lawrence <dkl@mozilla.com>2015-04-08 19:41:26 +0200
commit634f31d6c64894bcf2f0788525e9a9286e9de314 (patch)
tree5a352e756e0189391c2e1e9c69920cc7faa6f169 /extensions/ComponentWatching
parent426d9ce9a10c48a472c4937b5f652dc8c1b6486e (diff)
downloadbugzilla-634f31d6c64894bcf2f0788525e9a9286e9de314.tar.gz
bugzilla-634f31d6c64894bcf2f0788525e9a9286e9de314.tar.xz
Bug 1090493: Allow ComponentWatching extension to work on either bmo/4.2 or upstream 5.0+
Diffstat (limited to 'extensions/ComponentWatching')
-rw-r--r--extensions/ComponentWatching/Extension.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/extensions/ComponentWatching/Extension.pm b/extensions/ComponentWatching/Extension.pm
index 0af1ae6cf..1f507493f 100644
--- a/extensions/ComponentWatching/Extension.pm
+++ b/extensions/ComponentWatching/Extension.pm
@@ -29,6 +29,18 @@ use constant REL_COMPONENT_WATCHER => 15;
sub db_schema_abstract_schema {
my ($self, $args) = @_;
+ my $dbh = Bugzilla->dbh;
+
+ # Bugzilla 5.0+, the components.id type
+ # is INT3, while earlier versions used INT2
+ my $component_id_type = 'INT2';
+ my $len = scalar @{ $args->{schema}->{components}->{FIELDS} };
+ for (my $i = 0; $i < $len - 1; $i+=2) {
+ next if $args->{schema}->{components}->{FIELDS}->[$i] ne 'id';
+ $component_id_type = 'INT3'
+ if $args->{schema}->{components}->{FIELDS}->[$i+1]->{TYPE} eq 'MEDIUMSERIAL';
+ last;
+ }
$args->{'schema'}->{'component_watch'} = {
FIELDS => [
id => {
@@ -46,7 +58,7 @@ sub db_schema_abstract_schema {
}
},
component_id => {
- TYPE => 'INT2',
+ TYPE => $component_id_type,
NOTNULL => 0,
REFERENCES => {
TABLE => 'components',