Class: OnlineMigrations::DataMigrations::BackfillCallRecordRecordingSource
- Inherits:
-
OnlineMigrations::DataMigration
- Object
- OnlineMigrations::DataMigration
- OnlineMigrations::DataMigrations::BackfillCallRecordRecordingSource
- 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
-
#collection ⇒ ActiveRecord::Batches::BatchEnumerator
Batches of CallRecords missing a recording_source.
-
#count ⇒ Integer
Number of CallRecords missing a recording_source.
-
#process(call_records) ⇒ Integer
Number of rows updated.
Instance Method Details
#collection ⇒ ActiveRecord::Batches::BatchEnumerator
Returns batches of CallRecords missing a recording_source.
12 13 14 |
# File 'lib/online_migrations/data_migrations/backfill_call_record_recording_source.rb', line 12 def collection CallRecord.where(recording_source: nil).in_batches(of: BATCH_SIZE) end |
#count ⇒ Integer
Returns number of CallRecords missing a recording_source.
22 23 24 |
# File 'lib/online_migrations/data_migrations/backfill_call_record_recording_source.rb', line 22 def count CallRecord.where(recording_source: nil).count end |
#process(call_records) ⇒ Integer
Returns number of rows updated.
17 18 19 |
# File 'lib/online_migrations/data_migrations/backfill_call_record_recording_source.rb', line 17 def process(call_records) call_records.update_all(recording_source: 'switchvox') end |