2020-03-24 16:45:27 +01:00
|
|
|
# frozen_string_literal:true
|
|
|
|
|
2023-02-24 17:26:55 +01:00
|
|
|
# From this migration, we migrate all reservation-related data from Slot to SlotReservation
|
2020-03-24 16:45:27 +01:00
|
|
|
class MigrateSlotsReservations < ActiveRecord::Migration[4.2]
|
2017-02-28 13:23:31 +01:00
|
|
|
def up
|
|
|
|
Slot.all.each do |slot|
|
2023-02-24 17:26:55 +01:00
|
|
|
SlotsReservation.create!({ slot_id: slot.id, reservation_id: slot.reservation_id })
|
2017-02-28 13:23:31 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
SlotsReservation.all.each do |sr|
|
2023-02-24 17:26:55 +01:00
|
|
|
Slot.find(sr.slot_id).update(reservation_id: sr.reservation_id)
|
2017-02-28 13:23:31 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|