Merge branch '46019-add-missing-migration' into 'master'

Resolve "ActiveRecord::RecordInvalid: Validation failed: Build timeout needs to be at least 10 minutes"

Closes #46019

See merge request gitlab-org/gitlab-ce!18775
This commit is contained in:
Yorick Peterse 2018-06-01 11:01:24 +00:00
commit e206e32881
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
title: Add missing migration for minimal Project build_timeout
merge_request: 18775
author:
type: fixed

View File

@ -0,0 +1,19 @@
class SetMinimalProjectBuildTimeout < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
MINIMUM_TIMEOUT = 600
# Allow this migration to resume if it fails partway through
disable_ddl_transaction!
def up
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