1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00
fab-manager/db/migrate/20170227104934_migrate_slots_reservations.rb

17 lines
463 B
Ruby
Raw Normal View History

# 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
class MigrateSlotsReservations < ActiveRecord::Migration[4.2]
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 })
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)
end
end
end