summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2014-07-08 09:33:44 +0200
committerByron Jones <glob@mozilla.com>2014-07-08 09:33:44 +0200
commitd74129306d8d5a903af6fe3957046feb36affdd1 (patch)
tree88d9b55e3782c8c3177dbbdfbfd01463079b19c6 /extensions
parent64d77abe752e3d139dbfbb902f33d75e33d67fcc (diff)
downloadbugzilla-d74129306d8d5a903af6fe3957046feb36affdd1.tar.gz
bugzilla-d74129306d8d5a903af6fe3957046feb36affdd1.tar.xz
Bug 990980: create an extension for server-side filtering of bugmail
(schema only)
Diffstat (limited to 'extensions')
-rw-r--r--extensions/BugmailFilter/Config.pm15
-rw-r--r--extensions/BugmailFilter/Extension.pm82
2 files changed, 97 insertions, 0 deletions
diff --git a/extensions/BugmailFilter/Config.pm b/extensions/BugmailFilter/Config.pm
new file mode 100644
index 000000000..9932afb40
--- /dev/null
+++ b/extensions/BugmailFilter/Config.pm
@@ -0,0 +1,15 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+package Bugzilla::Extension::BugmailFilter;
+use strict;
+
+use constant NAME => 'BugmailFilter';
+use constant REQUIRED_MODULES => [];
+use constant OPTIONAL_MODULES => [];
+
+__PACKAGE__->NAME;
diff --git a/extensions/BugmailFilter/Extension.pm b/extensions/BugmailFilter/Extension.pm
new file mode 100644
index 000000000..e4a1be7ff
--- /dev/null
+++ b/extensions/BugmailFilter/Extension.pm
@@ -0,0 +1,82 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+package Bugzilla::Extension::BugmailFilter;
+use strict;
+use warnings;
+
+use base qw(Bugzilla::Extension);
+our $VERSION = '1';
+
+#
+# schema / install
+#
+
+sub db_schema_abstract_schema {
+ my ($self, $args) = @_;
+ $args->{schema}->{bugmail_filters} = {
+ FIELDS => [
+ id => {
+ TYPE => 'INTSERIAL',
+ NOTNULL => 1,
+ PRIMARYKEY => 1,
+ },
+ user_id => {
+ TYPE => 'INT3',
+ NOTNULL => 1,
+ REFERENCES => {
+ TABLE => 'profiles',
+ COLUMN => 'userid',
+ DELETE => 'CASCADE'
+ },
+ },
+ field_name => {
+ # due to fake fields, this can't be field_id
+ TYPE => 'VARCHAR(64)',
+ NOTNULL => 0,
+ },
+ product_id => {
+ TYPE => 'INT2',
+ NOTNULL => 0,
+ REFERENCES => {
+ TABLE => 'products',
+ COLUMN => 'id',
+ DELETE => 'CASCADE'
+ },
+ },
+ component_id => {
+ TYPE => 'INT2',
+ NOTNULL => 0,
+ REFERENCES => {
+ TABLE => 'components',
+ COLUMN => 'id',
+ DELETE => 'CASCADE'
+ },
+ },
+ relationship => {
+ TYPE => 'INT2',
+ NOTNULL => 0,
+ },
+ action => {
+ TYPE => 'INT1',
+ NOTNULL => 1,
+ },
+ ],
+ INDEXES => [
+ bugmail_filters_unique_idx => {
+ FIELDS => [ qw( user_id field_name product_id component_id
+ relationship ) ],
+ TYPE => 'UNIQUE',
+ },
+ bugmail_filters_user_idx => [
+ 'user_id',
+ ],
+ ],
+ };
+}
+
+__PACKAGE__->NAME;