summaryrefslogtreecommitdiff
path: root/db/post_migrate/20230208125736_schedule_migration_for_links.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-20 15:19:03 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-20 15:19:03 +0000
commit14bd84b61276ef29b97d23642d698de769bacfd2 (patch)
treef9eba90140c1bd874211dea17750a0d422c04080 /db/post_migrate/20230208125736_schedule_migration_for_links.rb
parent891c388697b2db0d8ee0c8358a9bdbf6dc56d581 (diff)
downloadgitlab-ce-14bd84b61276ef29b97d23642d698de769bacfd2.tar.gz
Add latest changes from gitlab-org/gitlab@15-10-stable-eev15.10.0-rc42
Diffstat (limited to 'db/post_migrate/20230208125736_schedule_migration_for_links.rb')
-rw-r--r--db/post_migrate/20230208125736_schedule_migration_for_links.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/db/post_migrate/20230208125736_schedule_migration_for_links.rb b/db/post_migrate/20230208125736_schedule_migration_for_links.rb
new file mode 100644
index 00000000000..c1bd1bbbe51
--- /dev/null
+++ b/db/post_migrate/20230208125736_schedule_migration_for_links.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class ScheduleMigrationForLinks < Gitlab::Database::Migration[2.1]
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ MIGRATION = 'MigrateLinksForVulnerabilityFindings'
+ DELAY_INTERVAL = 2.minutes
+ SUB_BATCH_SIZE = 500
+ BATCH_SIZE = 10000
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :vulnerability_occurrences,
+ :id,
+ job_interval: DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ sub_batch_size: SUB_BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :vulnerability_occurrences, :id, [])
+ end
+end