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

20180507083701_set_minimal_project_build_timeout.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 34edbb08bcf12545930d193f4de33a221a1e621c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class SetMinimalProjectBuildTimeout < ActiveRecord::Migration[4.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  MINIMUM_TIMEOUT = 600

  # Allow this migration to resume if it fails partway through
  disable_ddl_transaction!

  def up
    # rubocop:disable Migration/UpdateLargeTable
    # rubocop:disable Migration/UpdateColumnInBatches
    update_column_in_batches(:projects, :build_timeout, MINIMUM_TIMEOUT) do |table, query|
      query.where(table[:build_timeout].lt(MINIMUM_TIMEOUT))
    end
  end

  def down
    # no-op
  end
end