From f2a6697ebe207937bb53015a5213356ed5dc02d9 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 6 Oct 2022 18:12:28 +0200 Subject: [PATCH] fix(migration): backfill max_duree_conservation_dossiers_dans_ds without typo --- ...ckfill_procedure_max_duree_conservation_dossiers.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 db/migrate/20221006161143_re_backfill_procedure_max_duree_conservation_dossiers.rb 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