summaryrefslogtreecommitdiff
path: root/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-25 15:09:33 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-25 15:09:33 +0000
commitba8e92f7c9938d7dba333d2396cdd14bfa0de726 (patch)
tree071d3b0577dce2e95eefa6a504910bc7856181f3 /db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb
parentd2d913b606702ecefa01f03362602fde256e3f75 (diff)
downloadgitlab-ce-ba8e92f7c9938d7dba333d2396cdd14bfa0de726.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb')
-rw-r--r--db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb b/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb
new file mode 100644
index 00000000000..10b6ab8204d
--- /dev/null
+++ b/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class ScheduleNullifyOrphanRunnerIdOnCiBuilds < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ MIGRATION = 'NullifyOrphanRunnerIdOnCiBuilds'
+ INTERVAL = 2.minutes
+ BATCH_SIZE = 50_000
+ MAX_BATCH_SIZE = 150_000
+ SUB_BATCH_SIZE = 500
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :ci_builds,
+ :id,
+ job_interval: INTERVAL,
+ batch_size: BATCH_SIZE,
+ max_batch_size: MAX_BATCH_SIZE,
+ sub_batch_size: SUB_BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :ci_builds, :id, [])
+ end
+end