Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20210420103955_remove_hipchat_service_records.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5ad34cfad2261635af3f8f32f3b05a20b2e0b20e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

class RemoveHipchatServiceRecords < ActiveRecord::Migration[6.0]
  disable_ddl_transaction!

  class Service < ActiveRecord::Base
    include EachBatch

    self.table_name = 'services'
  end

  def up
    Service.each_batch(of: 100_000, column: :id) do |relation|
      relation.delete_by(type: 'HipchatService')
    end
  end

  def down
    # no-op
  end
end