diff options
Diffstat (limited to 'db/post_migrate/20190909141517_update_cs_vulnerability_confidence_column.rb')
-rw-r--r-- | db/post_migrate/20190909141517_update_cs_vulnerability_confidence_column.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/db/post_migrate/20190909141517_update_cs_vulnerability_confidence_column.rb b/db/post_migrate/20190909141517_update_cs_vulnerability_confidence_column.rb new file mode 100644 index 00000000000..befa08e0cb6 --- /dev/null +++ b/db/post_migrate/20190909141517_update_cs_vulnerability_confidence_column.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. +class UpdateCsVulnerabilityConfidenceColumn < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + DOWNTIME = false + BATCH_SIZE = 1_000 + INTERVAL = 5.minutes + + # 137_424 records to be updated on GitLab.com, + # giving us an estimated runtime of 12 hours. + def up + # no-op in CE + return unless Gitlab.ee? + + migration = Gitlab::BackgroundMigration::UpdateVulnerabilityConfidence + migration_name = migration.to_s.demodulize + relation = migration::Occurrence.container_scanning_reports_with_medium_confidence + queue_background_migration_jobs_by_range_at_intervals(relation, + migration_name, + INTERVAL, + batch_size: BATCH_SIZE) + end + + def down + # no-op + end +end |