2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-08-24 12:44:13 +02:00
|
|
|
class BackfillProceduresZones < ActiveRecord::Migration[6.1]
|
|
|
|
def up
|
|
|
|
# rubocop:disable DS/Unscoped
|
2024-02-05 11:20:55 +01:00
|
|
|
Procedure.unscoped.find_each do |procedure|
|
2022-08-24 12:44:13 +02:00
|
|
|
procedure.zones << procedure.zone if procedure.zone
|
|
|
|
end
|
|
|
|
# rubocop:enable DS/Unscoped
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
# rubocop:disable DS/Unscoped
|
2024-02-05 11:20:55 +01:00
|
|
|
Procedure.unscoped.find_each do |procedure|
|
2022-08-24 12:44:13 +02:00
|
|
|
procedure.zones.destroy_all
|
|
|
|
end
|
|
|
|
# rubocop:enable DS/Unscoped
|
|
|
|
end
|
|
|
|
end
|