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
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20210111075105_schedule_uuid_population_for_security_findings.rb')
-rw-r--r--db/post_migrate/20210111075105_schedule_uuid_population_for_security_findings.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/db/post_migrate/20210111075105_schedule_uuid_population_for_security_findings.rb b/db/post_migrate/20210111075105_schedule_uuid_population_for_security_findings.rb
new file mode 100644
index 00000000000..92241378495
--- /dev/null
+++ b/db/post_migrate/20210111075105_schedule_uuid_population_for_security_findings.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class ScheduleUuidPopulationForSecurityFindings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ MIGRATION_CLASS = 'PopulateUuidsForSecurityFindings'
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 25
+
+ disable_ddl_transaction!
+
+ def up
+ Gitlab::BackgroundMigration::PopulateUuidsForSecurityFindings.security_findings.each_batch(column: :scan_id, of: BATCH_SIZE) do |batch, index|
+ migrate_in(
+ DELAY_INTERVAL * index,
+ MIGRATION_CLASS,
+ batch.pluck(:scan_id)
+ )
+ end
+ end
+
+ def down
+ # no-op
+ end
+end