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

20230428085332_remove_shimo_zentao_integration_records.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 079f1527e014db7c3d5a22cf12b38a537268fb80 (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 RemoveShimoZentaoIntegrationRecords < Gitlab::Database::Migration[2.1]
  TYPES = %w[Integrations::Shimo Integrations::Zentao]
  BATCH_SIZE = 100

  disable_ddl_transaction!
  restrict_gitlab_migration gitlab_schema: :gitlab_main

  def up
    return if Gitlab.jh?

    define_batchable_model(:integrations)
      .where(type_new: TYPES)
      .each_batch(of: BATCH_SIZE) { |relation, _index| relation.delete_all }
  end

  def down
    # no-op
  end
end