diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /db/post_migrate/20210816183304_schedule_copy_ci_builds_columns_to_security_scans2.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'db/post_migrate/20210816183304_schedule_copy_ci_builds_columns_to_security_scans2.rb')
-rw-r--r-- | db/post_migrate/20210816183304_schedule_copy_ci_builds_columns_to_security_scans2.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/db/post_migrate/20210816183304_schedule_copy_ci_builds_columns_to_security_scans2.rb b/db/post_migrate/20210816183304_schedule_copy_ci_builds_columns_to_security_scans2.rb new file mode 100644 index 00000000000..b8f843fdd50 --- /dev/null +++ b/db/post_migrate/20210816183304_schedule_copy_ci_builds_columns_to_security_scans2.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class ScheduleCopyCiBuildsColumnsToSecurityScans2 < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + INTERVAL = 2.minutes.to_i + BATCH_SIZE = 5_000 + MIGRATION = 'CopyCiBuildsColumnsToSecurityScans' + + disable_ddl_transaction! + + class SecurityScan < ActiveRecord::Base + include EachBatch + + self.table_name = 'security_scans' + end + + def up + SecurityScan.reset_column_information + + delete_job_tracking(MIGRATION, status: %w[pending succeeded]) + + queue_background_migration_jobs_by_range_at_intervals( + SecurityScan, + MIGRATION, + INTERVAL, + batch_size: BATCH_SIZE, + track_jobs: true + ) + end + + def down + # noop + end +end |