summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-09-01 21:41:54 +0200
committerDavid Lawrence <dkl@mozilla.com>2015-09-01 21:41:54 +0200
commitf072be241bc5335a86758e3f6a1fa48cd7762f2d (patch)
treecad5c6ecd8dc5ec965d1970866677d21ab94d45b
parent7c39ca2f98f2f5431713ad387849217f12cc03c2 (diff)
downloadbugzilla-f072be241bc5335a86758e3f6a1fa48cd7762f2d.tar.gz
bugzilla-f072be241bc5335a86758e3f6a1fa48cd7762f2d.tar.xz
Bug 1196618: add support for group owners (schema only)
-rw-r--r--Bugzilla/DB/Schema.pm4
-rw-r--r--Bugzilla/Install/DB.pm10
2 files changed, 14 insertions, 0 deletions
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index 5869339a3..4cf0ef05e 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -1223,6 +1223,10 @@ use constant ABSTRACT_SCHEMA => {
isactive => {TYPE => 'BOOLEAN', NOTNULL => 1,
DEFAULT => 'TRUE'},
icon_url => {TYPE => 'TINYTEXT'},
+ owner_user_id => {TYPE => 'INT3',
+ REFERENCES => {
+ TABLE => 'profiles',
+ COLUMN => 'userid'}},
],
INDEXES => [
groups_name_idx => {FIELDS => ['name'], TYPE => 'UNIQUE'},
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index 867aefe19..2d454b81a 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -754,6 +754,8 @@ sub update_table_definitions {
$dbh->bz_add_column('profiles', 'mfa', { TYPE => 'varchar(8)', , DEFAULT => "''" });
+ _migrate_group_owners();
+
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
@@ -3883,6 +3885,14 @@ sub _add_restrict_ipaddr {
$dbh->do("UPDATE logincookies SET restrict_ipaddr = 1 WHERE ipaddr IS NOT NULL");
}
+sub _migrate_group_owners {
+ my $dbh = Bugzilla->dbh;
+ return if $dbh->bz_column_info('groups', 'owner_user_id');
+ $dbh->bz_add_column('groups', 'owner_user_id', {TYPE => 'INT3'});
+ my $nobody = Bugzilla::User->check('nobody@mozilla.org');
+ $dbh->do('UPDATE groups SET owner_user_id = ?', undef, $nobody->id);
+}
+
1;
__END__