Class: Gitlab::BackgroundMigration::MigrateU2fWebauthn

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/background_migration/migrate_u2f_webauthn.rb

Defined Under Namespace

Classes: U2fRegistration, WebauthnRegistration

Instance Method Summary collapse

Instance Method Details

#perform(start_id, end_id) ⇒ Object


15
16
17
18
19
20
21
22
23
24
25
# File 'lib/gitlab/background_migration/migrate_u2f_webauthn.rb', line 15

def perform(start_id, end_id)
  old_registrations = U2fRegistration.where(id: start_id..end_id)
  old_registrations.each_slice(100) do |slice|
    values = slice.map do |u2f_registration|
      converter = Gitlab::Auth::U2fWebauthnConverter.new(u2f_registration)
      converter.convert
    end

    WebauthnRegistration.insert_all(values, unique_by: :credential_xid, returning: false)
  end
end