summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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__