summaryrefslogtreecommitdiff
path: root/db/post_migrate/20210818185845_backfill_projects_with_coverage.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20210818185845_backfill_projects_with_coverage.rb')
-rw-r--r--db/post_migrate/20210818185845_backfill_projects_with_coverage.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/db/post_migrate/20210818185845_backfill_projects_with_coverage.rb b/db/post_migrate/20210818185845_backfill_projects_with_coverage.rb
new file mode 100644
index 00000000000..003b7536767
--- /dev/null
+++ b/db/post_migrate/20210818185845_backfill_projects_with_coverage.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+class BackfillProjectsWithCoverage < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ MIGRATION = 'BackfillProjectsWithCoverage'
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 10_000
+ SUB_BATCH_SIZE = 1_000
+
+ disable_ddl_transaction!
+
+ class CiDailyBuildGroupReportResult < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'ci_daily_build_group_report_results'
+ end
+
+ def up
+ queue_background_migration_jobs_by_range_at_intervals(
+ CiDailyBuildGroupReportResult,
+ MIGRATION,
+ DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ other_job_arguments: [SUB_BATCH_SIZE]
+ )
+ end
+
+ def down
+ # noop
+ end
+end