demarches-normaliennes/db/migrate/20221006193737_backfill_procedures_zones.rb

18 lines
426 B
Ruby
Raw Normal View History

2022-08-24 12:44:13 +02:00
class BackfillProceduresZones < ActiveRecord::Migration[6.1]
def up
# rubocop:disable DS/Unscoped
Procedure.unscoped.each do |procedure|
procedure.zones << procedure.zone if procedure.zone
end
# rubocop:enable DS/Unscoped
end
def down
# rubocop:disable DS/Unscoped
Procedure.unscoped.each do |procedure|
procedure.zones.destroy_all
end
# rubocop:enable DS/Unscoped
end
end