summaryrefslogtreecommitdiff
path: root/db/post_migrate/20180220150310_remove_empty_extern_uid_auth0_identities.rb
blob: 86ef333685ede566aefe67693bd2bd25a47a0743 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class RemoveEmptyExternUidAuth0Identities < ActiveRecord::Migration[4.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  class Identity < ActiveRecord::Base
    self.table_name = 'identities'
    include EachBatch
  end

  def up
    broken_auth0_identities.each_batch do |identity|
      identity.delete_all
    end
  end

  def broken_auth0_identities
    Identity.where(provider: 'auth0', extern_uid: [nil, ''])
  end

  def down
  end
end