summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Install/DB.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/Install/DB.pm')
-rw-r--r--Bugzilla/Install/DB.pm25
1 files changed, 25 insertions, 0 deletions
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index a6ca1e90f..b7ca7c657 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -748,6 +748,10 @@ sub update_table_definitions {
# 2015-12-16 LpSolit@gmail.com - Bug 1232578
_sanitize_audit_log_table();
+ # 2016-04-27 wurblzap@gmail.com and gerv@gerv.net - Bug 218917
+ # Split login_name into login_name and email columns
+ _split_login_and_email($old_params);
+
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
@@ -3957,6 +3961,27 @@ sub _sanitize_audit_log_table {
}
}
+sub _split_login_and_email {
+ my ($old_params) = (@_);
+
+ my $dbh = Bugzilla->dbh;
+ $dbh->bz_add_column('profiles', 'email',
+ {TYPE => 'varchar(255)', NOTNULL => 1}, '');
+ $dbh->do('UPDATE profiles SET email = login_name');
+
+ # This change obsoletes the 'emailsuffix' parameter. If it is in use,
+ # append it to all the values in the 'email' column.
+ my $suffix = $old_params->{'emailsuffix'};
+ if ($suffix) {
+ $dbh->do('UPDATE profiles SET email = ' . $dbh->sql_string_concat('email', '?'),
+ undef, $suffix);
+ }
+
+ $dbh->bz_add_index('profiles', 'profiles_email_idx',
+ {TYPE => 'UNIQUE', FIELDS => ['email']});
+}
+
+
1;
__END__