summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-24 21:06:18 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-24 21:06:18 +0000
commit150effab274651b3a8d2041e64ced734d1f3a349 (patch)
tree7f887964a56bd15a87d58cd367ccc1fa45f98554 /db
parent2ed368929ab5094fec5da8038f723463596a80cf (diff)
downloadgitlab-ce-150effab274651b3a8d2041e64ced734d1f3a349.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20190909141517_update_cs_vulnerability_confidence_column.rb29
1 files changed, 29 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..20f5e7ae0dc
--- /dev/null
+++ b/db/post_migrate/20190909141517_update_cs_vulnerability_confidence_column.rb
@@ -0,0 +1,29 @@
+# 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
+ 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