summaryrefslogtreecommitdiff
path: root/db/post_migrate/20220119094503_populate_audit_event_streaming_verification_token.rb
blob: 482f873739a9cdb81c9ec24e5d12eedf620393c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

class PopulateAuditEventStreamingVerificationToken < Gitlab::Database::Migration[1.0]
  class ExternalAuditEventDestination < ActiveRecord::Base
    self.table_name = 'audit_events_external_audit_event_destinations'

    def regenerate_verification_token
      update!(verification_token: SecureRandom.base58(24))
    end
  end

  def up
    ExternalAuditEventDestination.all.each { |destination| destination.regenerate_verification_token }
  end

  def down
    # no-op
  end
end