Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-24 04:43:31 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-24 04:43:31 +0300
commite20a1cde5d740fbc9f4d033786a8cd5ad7eb8b4d (patch)
treecf76b0527f1909eaf1ecac057a4ccc7591cce4f6 /db
parent5fc725def41e6973e92bc32095774edd60fd154f (diff)
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20200416111111_migrate_vulnerability_dismissals.rb37
-rw-r--r--db/structure.sql1
2 files changed, 38 insertions, 0 deletions
diff --git a/db/post_migrate/20200416111111_migrate_vulnerability_dismissals.rb b/db/post_migrate/20200416111111_migrate_vulnerability_dismissals.rb
new file mode 100644
index 00000000000..6ec8b991968
--- /dev/null
+++ b/db/post_migrate/20200416111111_migrate_vulnerability_dismissals.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+class MigrateVulnerabilityDismissals < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ MIGRATION = 'UpdateVulnerabilitiesToDismissed'.freeze
+ BATCH_SIZE = 500
+ DELAY_INTERVAL = 2.minutes.to_i
+
+ class Vulnerability < ActiveRecord::Base
+ self.table_name = 'vulnerabilities'
+ self.inheritance_column = :_type_disabled
+
+ include ::EachBatch
+ end
+
+ def up
+ return unless Gitlab.ee?
+
+ Vulnerability.select('project_id').group(:project_id).each_batch(of: BATCH_SIZE, column: "project_id") do |project_batch, index|
+ batch_delay = (index - 1) * BATCH_SIZE * DELAY_INTERVAL
+
+ project_batch.each_with_index do |project, project_batch_index|
+ project_delay = project_batch_index * DELAY_INTERVAL
+ migrate_in(batch_delay + project_delay, MIGRATION, project[:project_id])
+ end
+ end
+ end
+
+ def down
+ # nothing to do
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index 52852117fa6..3fec80b1aba 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -13211,6 +13211,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200415161021
20200415161206
20200415192656
+20200416111111
20200416120128
20200416120354
\.