Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-09-23 05:26:48 +0300
committerStan Hu <stanhu@gmail.com>2017-09-23 05:45:25 +0300
commit2e564ddfc7ac500b72051d56b9a6b37979296c0e (patch)
tree9e3bccd0b895032e2081ec917d993e96e350efdc /db/migrate/20170828135939_migrate_user_external_mail_data.rb
parent024d10b7adabe4ca2fc42107837367cb086fe75c (diff)
Fix duplicate key errors in PostDeployMigrateUserExternalMailData migration
`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. Closes #38246
Diffstat (limited to 'db/migrate/20170828135939_migrate_user_external_mail_data.rb')
-rw-r--r--db/migrate/20170828135939_migrate_user_external_mail_data.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/db/migrate/20170828135939_migrate_user_external_mail_data.rb b/db/migrate/20170828135939_migrate_user_external_mail_data.rb
index 592e141b7e6..395181a3b22 100644
--- a/db/migrate/20170828135939_migrate_user_external_mail_data.rb
+++ b/db/migrate/20170828135939_migrate_user_external_mail_data.rb
@@ -33,7 +33,7 @@ class MigrateUserExternalMailData < ActiveRecord::Migration
SELECT true
FROM user_synced_attributes_metadata
WHERE user_id = users.id
- AND provider = users.email_provider
+ AND provider = users.email_provider OR (provider IS NULL AND users.email_provider IS NULL)
)
AND id BETWEEN #{start_id} AND #{end_id}
EOF