Merge pull request #7868 from mfo/US/fix-migration-backfill

fix(migration): backfill max_duree_conservation_dossiers_dans_ds with…
This commit is contained in:
mfo 2022-10-06 20:47:16 +02:00 committed by GitHub
commit 5a6dddc6d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,10 @@
class ReBackfillProcedureMaxDureeConservationDossiers < ActiveRecord::Migration[6.1]
def change
Procedure.where(duree_conservation_etendue_par_ds: true).in_batches do |batch|
batch.update_all(max_duree_conservation_dossiers_dans_ds: Procedure::OLD_MAX_DUREE_CONSERVATION)
end
Procedure.where(duree_conservation_etendue_par_ds: false).in_batches do |batch|
batch.update_all(max_duree_conservation_dossiers_dans_ds: Procedure::NEW_MAX_DUREE_CONSERVATION)
end
end
end