summaryrefslogtreecommitdiffstats
path: root/extensions/TrackingFlags/Extension.pm
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/TrackingFlags/Extension.pm')
-rw-r--r--extensions/TrackingFlags/Extension.pm191
1 files changed, 191 insertions, 0 deletions
diff --git a/extensions/TrackingFlags/Extension.pm b/extensions/TrackingFlags/Extension.pm
new file mode 100644
index 000000000..a7cfe97c9
--- /dev/null
+++ b/extensions/TrackingFlags/Extension.pm
@@ -0,0 +1,191 @@
+# 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::TrackingFlags;
+
+use strict;
+
+use base qw(Bugzilla::Extension);
+
+our $VERSION = '1';
+
+sub db_schema_abstract_schema {
+ my ($self, $args) = @_;
+ $args->{'schema'}->{'tracking_flags'} = {
+ FIELDS => [
+ id => {
+ TYPE => 'MEDIUMSERIAL',
+ NOTNULL => 1,
+ PRIMARYKEY => 1,
+ },
+ field_id => {
+ TYPE => 'INT3',
+ NOTNULL => 1,
+ REFERENCES => {
+ TABLE => 'fielddefs',
+ COLUMN => 'id'
+ }
+ },
+ name => {
+ TYPE => 'varchar(64)',
+ NOTNULL => 1,
+ },
+ description => {
+ TYPE => 'varchar(64)',
+ NOTNULL => 1,
+ },
+ type => {
+ TYPE => 'varchar(64)',
+ NOTNULL => 1,
+ },
+ sortkey => {
+ TYPE => 'INT2',
+ NOTNULL => 1,
+ DEFAULT => '0',
+ },
+ is_active => {
+ TYPE => 'BOOLEAN',
+ NOTNULL => 1,
+ DEFAULT => 'TRUE',
+ },
+ ],
+ INDEXES => [
+ tracking_flags_idx => {
+ FIELDS => ['name'],
+ TYPE => 'UNIQUE',
+ },
+ ],
+ };
+ $args->{'schema'}->{'tracking_flags_values'} = {
+ FIELDS => [
+ id => {
+ TYPE => 'MEDIUMSERIAL',
+ NOTNULL => 1,
+ PRIMARYKEY => 1,
+ },
+ tracking_flag_id => {
+ TYPE => 'INT3',
+ NOTNULL => 1,
+ REFERENCES => {
+ TABLE => 'tracking_flags',
+ COLUMN => 'id',
+ DELETE => 'CASCADE',
+ },
+ },
+ setter_group_id => {
+ TYPE => 'INT3',
+ NOTNULL => 0,
+ REFERENCES => {
+ TABLE => 'groups',
+ COLUMN => 'id',
+ DELETE => 'SET NULL',
+ },
+ },
+ value => {
+ TYPE => 'varchar(64)',
+ NOTNULL => 1,
+ },
+ sortkey => {
+ TYPE => 'INT2',
+ NOTNULL => 1,
+ DEFAULT => '0',
+ },
+ is_active => {
+ TYPE => 'BOOLEAN',
+ NOTNULL => 1,
+ DEFAULT => 'TRUE',
+ },
+ ],
+ INDEXES => [
+ tracking_flags_values_idx => {
+ FIELDS => ['tracking_flag_id', 'value'],
+ TYPE => 'UNIQUE',
+ },
+ ],
+ };
+ $args->{'schema'}->{'tracking_flags_bugs'} = {
+ FIELDS => [
+ id => {
+ TYPE => 'MEDIUMSERIAL',
+ NOTNULL => 1,
+ PRIMARYKEY => 1,
+ },
+ tracking_flag_id => {
+ TYPE => 'INT3',
+ NOTNULL => 1,
+ REFERENCES => {
+ TABLE => 'tracking_flags',
+ COLUMN => 'id',
+ DELETE => 'CASCADE',
+ },
+ },
+ bug_id => {
+ TYPE => 'INT3',
+ NOTNULL => 1,
+ REFERENCES => {
+ TABLE => 'bugs',
+ COLUMN => 'bug_id',
+ DELETE => 'CASCADE',
+ },
+ },
+ value => {
+ TYPE => 'varchar(64)',
+ NOTNULL => 1,
+ },
+ ],
+ INDEXES => [
+ tracking_flags_bugs_idx => {
+ FIELDS => ['tracking_flag_id', 'bug_id'],
+ TYPE => 'UNIQUE',
+ },
+ ],
+ };
+ $args->{'schema'}->{'tracking_flags_visibility'} = {
+ FIELDS => [
+ id => {
+ TYPE => 'MEDIUMSERIAL',
+ NOTNULL => 1,
+ PRIMARYKEY => 1,
+ },
+ tracking_flag_id => {
+ TYPE => 'INT3',
+ NOTNULL => 1,
+ REFERENCES => {
+ TABLE => 'tracking_flags',
+ COLUMN => 'id',
+ DELETE => 'CASCADE',
+ },
+ },
+ product_id => {
+ TYPE => 'INT2',
+ NOTNULL => 1,
+ REFERENCES => {
+ TABLE => 'products',
+ COLUMN => 'id',
+ DELETE => 'CASCADE',
+ },
+ },
+ component_id => {
+ TYPE => 'INT2',
+ NOTNULL => 0,
+ REFERENCES => {
+ TABLE => 'components',
+ COLUMN => 'id',
+ DELETE => 'CASCADE',
+ },
+ },
+ ],
+ INDEXES => [
+ tracking_flags_visibility_idx => {
+ FIELDS => ['tracking_flag_id', 'product_id', 'component_id'],
+ TYPE => 'UNIQUE',
+ },
+ ],
+ };
+}
+
+__PACKAGE__->NAME;