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

20231003142706_lower_project_build_timeout_to_respect_max_validation.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b3a9bf00418e99ed7b79149cc8887d52bbda0867 (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 LowerProjectBuildTimeoutToRespectMaxValidation < Gitlab::Database::Migration[2.1]
  restrict_gitlab_migration gitlab_schema: :gitlab_main

  class Project < MigrationRecord
    self.table_name = 'projects'

    include EachBatch
  end

  def up
    Project.where("build_timeout >= #{1.month.to_i}").each_batch(of: 10) do |records|
      records.update_all(build_timeout: (1.month - 1.second).to_i)
    end
  end

  def down
    # no-op
  end
end