Class: OnlineMigrations::DataMigrations::BackfillCallRecordRecordingSource

Inherits:
OnlineMigrations::DataMigration
  • Object
show all
Defined in:
lib/online_migrations/data_migrations/backfill_call_record_recording_source.rb

Overview

Backfill recording_source = 'switchvox' for existing CallRecords with NULL
This ensures the recording source filter works correctly for both sources.

Constant Summary collapse

BATCH_SIZE =

Batch size.

5_000

Instance Method Summary collapse

Instance Method Details

#collectionObject



11
12
13
# File 'lib/online_migrations/data_migrations/backfill_call_record_recording_source.rb', line 11

def collection
  CallRecord.where(recording_source: nil).in_batches(of: BATCH_SIZE)
end

#countObject



19
20
21
# File 'lib/online_migrations/data_migrations/backfill_call_record_recording_source.rb', line 19

def count
  CallRecord.where(recording_source: nil).count
end

#process(call_records) ⇒ Object



15
16
17
# File 'lib/online_migrations/data_migrations/backfill_call_record_recording_source.rb', line 15

def process(call_records)
  call_records.update_all(recording_source: 'switchvox')
end