Skip to content

Fix duplicate key errors in PostDeployMigrateUserExternalMailData migration

Stan Hu requested to merge sh-fix-issue-38246 into master

email_provider by default is NULL, and if a user had not logged the value would remain NULL. Upgrading to GitLab 10.0 would lead to a PG::UniqueViolation because the post-deploy migration would attempt to reinsert the entry because the NULL comparison between users.email_provider and user_synced_attributes_metadata.email_provider would never match.

See https://stackoverflow.com/questions/20237544/sql-field-other-field-returns-false-even-if-they-are-identical-null-values for more details about SQL behavior.

Closes #38246 (closed)

Edited by Stan Hu

Merge request reports

Loading