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

20220606080509_fix_incorrect_job_artifacts_expire_at.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8fea22f5579a019cc2f9ce5eb2ef8e8657c0abb9 (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
29
30
31
# frozen_string_literal: true

class FixIncorrectJobArtifactsExpireAt < Gitlab::Database::Migration[2.0]
  disable_ddl_transaction!

  restrict_gitlab_migration gitlab_schema: :gitlab_ci

  MIGRATION = 'RemoveBackfilledJobArtifactsExpireAt'
  BATCH_CLASS = 'RemoveBackfilledJobArtifactsExpireAtBatchingStrategy'
  BATCH_SIZE = 500
  INTERVAL = 2.minutes.freeze

  def up
    return if Gitlab.com?

    queue_batched_background_migration(
      MIGRATION,
      :ci_job_artifacts,
      :id,
      job_interval: INTERVAL,
      batch_class_name: BATCH_CLASS,
      batch_size: BATCH_SIZE
    )
  end

  def down
    return if Gitlab.com?

    delete_batched_background_migration(MIGRATION, :ci_job_artifacts, :id, [])
  end
end