diff options
Diffstat (limited to 'db/post_migrate/20220119094503_populate_audit_event_streaming_verification_token.rb')
-rw-r--r-- | db/post_migrate/20220119094503_populate_audit_event_streaming_verification_token.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/post_migrate/20220119094503_populate_audit_event_streaming_verification_token.rb b/db/post_migrate/20220119094503_populate_audit_event_streaming_verification_token.rb new file mode 100644 index 00000000000..482f873739a --- /dev/null +++ b/db/post_migrate/20220119094503_populate_audit_event_streaming_verification_token.rb @@ -0,0 +1,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 |