Commit 58b12b3d authored by Mehmet Emin INAC's avatar Mehmet Emin INAC

Iterate through all feedback records on migration

parent b48df2a0
......@@ -12,7 +12,7 @@ class SchedulePopulateFindingUuidForVulnerabilityFeedback < ActiveRecord::Migrat
def up
queue_background_migration_jobs_by_range_at_intervals(
Gitlab::BackgroundMigration::PopulateFindingUuidForVulnerabilityFeedback::VulnerabilityFeedback.without_uuid,
Gitlab::BackgroundMigration::PopulateFindingUuidForVulnerabilityFeedback::VulnerabilityFeedback,
MIGRATION_CLASS,
DELAY_INTERVAL,
batch_size: BATCH_SIZE
......
......@@ -22,7 +22,7 @@ module Gitlab
enum category: REPORT_TYPES
scope :in_range, -> (start, stop) { where('id BETWEEN ? AND ?', start, stop) }
scope :in_range, -> (start, stop) { where(id: start..stop) }
scope :without_uuid, -> { where(finding_uuid: nil) }
def self.load_vulnerability_findings
......
......@@ -29,8 +29,9 @@ RSpec.describe SchedulePopulateFindingUuidForVulnerabilityFeedback do
it 'schedules the background jobs', :aggregate_failures do
migrate!
expect(BackgroundMigrationWorker.jobs.size).to be(2)
expect(BackgroundMigrationWorker.jobs.size).to be(3)
expect(described_class::MIGRATION_CLASS).to be_scheduled_delayed_migration(2.minutes, feedback_1.id, feedback_1.id)
expect(described_class::MIGRATION_CLASS).to be_scheduled_delayed_migration(4.minutes, feedback_2.id, feedback_2.id)
expect(described_class::MIGRATION_CLASS).to be_scheduled_delayed_migration(6.minutes, feedback_3.id, feedback_3.id)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment