Class: Gitlab::BackgroundMigration::WrongfullyConfirmedEmailUnconfirmer::EmailModel

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/gitlab/background_migration/wrongfully_confirmed_email_unconfirmer.rb

Class Method Summary collapse

Class Method Details

.wrongfully_confirmed_emails(start_id, stop_id) ⇒ Object


26
27
28
29
30
31
32
33
34
# File 'lib/gitlab/background_migration/wrongfully_confirmed_email_unconfirmer.rb', line 26

def self.wrongfully_confirmed_emails(start_id, stop_id)
  joins(:user)
    .merge(UserModel.active)
    .where(id: (start_id..stop_id))
    .where('emails.confirmed_at IS NOT NULL')
    .where('emails.confirmed_at = users.confirmed_at')
    .where('emails.email <> users.email')
    .where('NOT EXISTS (SELECT 1 FROM user_synced_attributes_metadata WHERE user_id=users.id AND email_synced IS true)')
end