Skip to content

Remove not_null constraint and default for public_email

What does this MR do and why?

Solves #341055 (closed)

This MR defines public_email the same way as the other 2 secondary emails: public_email character varying

Reasons:

We can observe an error occurring since code to set public_email to an empty-string was removed.

User secondary emails are defined in SQL as follows:

  • commit_email character varying
  • notification_email character varying
  • public_email character varying DEFAULT ''::character varying NOT NULL

For Database review:

== 20211018123316 RemoveNotNullConstraintAndDefaultForPublicEmail: migrating ==
-- change_column_null(:users, :public_email, true)
   -> 0.0026s
-- change_column_default(:users, :public_email, {:from=>"", :to=>nil})
   -> 0.0115s
== 20211018123316 RemoveNotNullConstraintAndDefaultForPublicEmail: migrated (0.0142s)

== 20211018123316 RemoveNotNullConstraintAndDefaultForPublicEmail: reverting ==
-- change_column_null(:users, :public_email, false, "")
   -> 0.0323s
-- change_column_default(:users, :public_email, {:from=>nil, :to=>""})
   -> 0.0155s
== 20211018123316 RemoveNotNullConstraintAndDefaultForPublicEmail: reverted (0.0479s)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Magdalena Frankiewicz

Merge request reports

Loading