blob: e14cd7ac3ee45a5393717c5f6be4ffbdf5afe4cc (
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
26
27
28
|
# frozen_string_literal: true
class DeleteUserCalloutAlertsMoved < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
class UserCallout < ActiveRecord::Base
include EachBatch
self.table_name = 'user_callouts'
end
BATCH_SIZE = 1_000
# Inlined from UserCalloutEnums.feature_names
FEATURE_NAME_ALERTS_MOVED = 20
def up
UserCallout.each_batch(of: BATCH_SIZE, column: :user_id) do |callout|
callout.where(feature_name: FEATURE_NAME_ALERTS_MOVED).delete_all
end
end
def down
# no-op
end
end
|