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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20231003142706_lower_project_build_timeout_to_respect_max_validation.rb')
-rw-r--r--db/post_migrate/20231003142706_lower_project_build_timeout_to_respect_max_validation.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/db/post_migrate/20231003142706_lower_project_build_timeout_to_respect_max_validation.rb b/db/post_migrate/20231003142706_lower_project_build_timeout_to_respect_max_validation.rb
new file mode 100644
index 00000000000..b3a9bf00418
--- /dev/null
+++ b/db/post_migrate/20231003142706_lower_project_build_timeout_to_respect_max_validation.rb
@@ -0,0 +1,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