demarches-normaliennes/db/migrate/20221006193737_backfill_procedures_zones.rb
2024-08-22 09:26:48 +02:00

19 lines
467 B
Ruby

# frozen_string_literal: true
class BackfillProceduresZones < ActiveRecord::Migration[6.1]
def up
# rubocop:disable DS/Unscoped
Procedure.unscoped.find_each do |procedure|
procedure.zones << procedure.zone if procedure.zone
end
# rubocop:enable DS/Unscoped
end
def down
# rubocop:disable DS/Unscoped
Procedure.unscoped.find_each do |procedure|
procedure.zones.destroy_all
end
# rubocop:enable DS/Unscoped
end
end