1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00
fab-manager/db/migrate/20230831103208_add_is_confirm_to_slots_reservations.rb

17 lines
482 B
Ruby

# frozen_string_literal: true
# add is_confirm to slots_reservations
class AddIsConfirmToSlotsReservations < ActiveRecord::Migration[7.0]
def up
add_column :slots_reservations, :is_confirm, :boolean
SlotsReservation.reset_column_information
SlotsReservation.all.each do |sr|
sr.update_column(:is_confirm, true) if sr.is_valid && sr.reservation.invoice_items.count.positive?
end
end
def down
remove_column :slots_reservations, :is_confirm
end
end