db(bulk messages): backfill bulk_messages with procedure_id
This commit is contained in:
parent
31ba16da02
commit
a5cfafbf27
1 changed files with 13 additions and 0 deletions
|
@ -0,0 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Maintenance
|
||||
class BackfillBulkMessagesWithProcedureIdTask < MaintenanceTasks::Task
|
||||
def collection
|
||||
BulkMessage.all.filter { |bm| bm.procedure.nil? && bm.groupe_instructeurs.present? }
|
||||
end
|
||||
|
||||
def process(element)
|
||||
element.update(procedure_id: element.groupe_instructeurs.first.procedure.id)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue