diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /db/post_migrate/20210706142819_re_schedule_latest_pipeline_id_population.rb | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'db/post_migrate/20210706142819_re_schedule_latest_pipeline_id_population.rb')
-rw-r--r-- | db/post_migrate/20210706142819_re_schedule_latest_pipeline_id_population.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/db/post_migrate/20210706142819_re_schedule_latest_pipeline_id_population.rb b/db/post_migrate/20210706142819_re_schedule_latest_pipeline_id_population.rb new file mode 100644 index 00000000000..709e0be8b79 --- /dev/null +++ b/db/post_migrate/20210706142819_re_schedule_latest_pipeline_id_population.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class ReScheduleLatestPipelineIdPopulation < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + DELAY_INTERVAL = 2.minutes.to_i + BATCH_SIZE = 100 + MIGRATION = 'PopulateLatestPipelineIds' + + disable_ddl_transaction! + + def up + return unless Gitlab.ee? + + queue_background_migration_jobs_by_range_at_intervals( + Gitlab::BackgroundMigration::PopulateLatestPipelineIds::ProjectSetting.has_vulnerabilities_without_latest_pipeline_set, + MIGRATION, + DELAY_INTERVAL, + batch_size: BATCH_SIZE, + primary_column_name: 'project_id' + ) + end + + def down + # no-op + end +end |