diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2016-04-27 18:50:13 +0200 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2016-04-27 18:50:13 +0200 |
commit | 3891b63a1eb52076337885487f251a10580a4a85 (patch) | |
tree | db1463894b756a6bb5114644feeec704ec886eb5 /Bugzilla/Install/DB.pm | |
parent | c44470a368465adfe329fcfc32492829a21878da (diff) | |
download | bugzilla-3891b63a1eb52076337885487f251a10580a4a85.tar.gz bugzilla-3891b63a1eb52076337885487f251a10580a4a85.tar.xz |
Bug 218917 - Allow the login name to be different from the email address
Original patch by Gervase Markham
r=gerv a=dkl
Diffstat (limited to 'Bugzilla/Install/DB.pm')
-rw-r--r-- | Bugzilla/Install/DB.pm | 25 |
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__ |