From 1551a42f3337482bd6aaa1493d987e05d704f128 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Thu, 18 Jul 2013 14:11:27 +0800 Subject: Bug 804708: Add a 'Review' extension to customise the review flag for Mozilla's workflow (make requestee/reviewer mandatory, provide review suggestions, etc) [schema only] --- extensions/Review/Config.pm | 15 +++++ extensions/Review/Extension.pm | 121 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 extensions/Review/Config.pm create mode 100644 extensions/Review/Extension.pm diff --git a/extensions/Review/Config.pm b/extensions/Review/Config.pm new file mode 100644 index 000000000..f7da458af --- /dev/null +++ b/extensions/Review/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::Review; +use strict; + +use constant NAME => 'Review'; +use constant REQUIRED_MODULES => []; +use constant OPTIONAL_MODULES => []; + +__PACKAGE__->NAME; diff --git a/extensions/Review/Extension.pm b/extensions/Review/Extension.pm new file mode 100644 index 000000000..cb7aa74e9 --- /dev/null +++ b/extensions/Review/Extension.pm @@ -0,0 +1,121 @@ +# 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::Review; +use strict; +use warnings; + +use base qw(Bugzilla::Extension); +our $VERSION = '1'; + +use Bugzilla; + +# +# installation +# + +sub db_schema_abstract_schema { + my ($self, $args) = @_; + $args->{'schema'}->{'product_reviewers'} = { + FIELDS => [ + id => { + TYPE => 'MEDIUMSERIAL', + NOTNULL => 1, + PRIMARYKEY => 1, + }, + user_id => { + TYPE => 'INT3', + NOTNULL => 1, + REFERENCES => { + TABLE => 'profiles', + COLUMN => 'userid', + DELETE => 'CASCADE', + } + }, + display_name => { + TYPE => 'VARCHAR(64)', + }, + product_id => { + TYPE => 'INT2', + NOTNULL => 1, + REFERENCES => { + TABLE => 'products', + COLUMN => 'id', + DELETE => 'CASCADE', + } + }, + sortkey => { + TYPE => 'INT2', + NOTNULL => 1, + DEFAULT => 0, + }, + ], + INDEXES => [ + product_reviewers_idx => { + FIELDS => [ 'user_id', 'product_id' ], + TYPE => 'UNIQUE', + }, + ], + }; + $args->{'schema'}->{'component_reviewers'} = { + FIELDS => [ + id => { + TYPE => 'MEDIUMSERIAL', + NOTNULL => 1, + PRIMARYKEY => 1, + }, + user_id => { + TYPE => 'INT3', + NOTNULL => 1, + REFERENCES => { + TABLE => 'profiles', + COLUMN => 'userid', + DELETE => 'CASCADE', + } + }, + display_name => { + TYPE => 'VARCHAR(64)', + }, + component_id => { + TYPE => 'INT2', + NOTNULL => 1, + REFERENCES => { + TABLE => 'components', + COLUMN => 'id', + DELETE => 'CASCADE', + } + }, + sortkey => { + TYPE => 'INT2', + NOTNULL => 1, + DEFAULT => 0, + }, + ], + INDEXES => [ + component_reviewers_idx => { + FIELDS => [ 'user_id', 'component_id' ], + TYPE => 'UNIQUE', + }, + ], + }; + +} + +sub install_update_db { + my $dbh = Bugzilla->dbh; + $dbh->bz_add_column( + 'products', + 'reviewer_required', + { + TYPE => 'BOOLEAN', + NOTNULL => 1, + DEFAULT => 'FALSE', + } + ); +} + +__PACKAGE__->NAME; -- cgit v1.2.3-24-g4f1b