summaryrefslogtreecommitdiff
path: root/lib/gitlab/background_migration/update_board_milestones_from_none_to_any.rb
blob: 27da8a5f23b2284043c3c31be04f6badc7bef121 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true
# rubocop:disable Style/Documentation

module Gitlab
  module BackgroundMigration
    class UpdateBoardMilestonesFromNoneToAny
      class Board < ActiveRecord::Base
        self.table_name = 'boards'
      end

      def perform(start_id, stop_id)
        Rails.logger.info("Setting board milestones from None to Any: #{start_id} - #{stop_id}") # rubocop:disable Gitlab/RailsLogger

        update = 'UPDATE boards SET milestone_id = null'

        Board.where(id: start_id..stop_id).update_all(update)
      end
    end
  end
end