demarches-normaliennes/app/tasks/maintenance/fill_champs_stable_id_task.rb

19 lines
398 B
Ruby
Raw Normal View History

2024-03-15 14:56:46 +01:00
# frozen_string_literal: true
module Maintenance
class FillChampsStableIdTask < MaintenanceTasks::Task
def collection
Dossier.all
2024-03-15 14:56:46 +01:00
end
def process(dossier)
dossier.champs
.includes(:type_de_champ)
.where(stable_id: nil)
2024-03-19 16:20:24 +01:00
.find_each do |champ|
champ.update_columns(stable_id: champ.stable_id, stream: 'main')
end
end
2024-03-15 14:56:46 +01:00
end
end