diff --git a/db/migrate/20221006161143_re_backfill_procedure_max_duree_conservation_dossiers.rb b/db/migrate/20221006161143_re_backfill_procedure_max_duree_conservation_dossiers.rb new file mode 100644 index 000000000..9f02df086 --- /dev/null +++ b/db/migrate/20221006161143_re_backfill_procedure_max_duree_conservation_dossiers.rb @@ -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