summaryrefslogtreecommitdiff
path: root/db/post_migrate/20220803042352_cleanup_mr_attention_request_todos.rb
blob: d3b281b08ada59fabce0eb220d446a4f18a6f3ae (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
# frozen_string_literal: true

class CleanupMrAttentionRequestTodos < Gitlab::Database::Migration[2.0]
  disable_ddl_transaction!
  restrict_gitlab_migration gitlab_schema: :gitlab_main

  class Todo < MigrationRecord
    self.table_name = 'todos'

    include ::EachBatch

    ATTENTION_REQUESTED = 10
  end

  def up
    Todo.where(action: Todo::ATTENTION_REQUESTED).each_batch do |todos_batch|
      todos_batch.delete_all
    end
  end

  def down
    # Attention request feature has been reverted.
  end
end