1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/db/migrate/20230710072403_add_is_valid_to_slots_reservations.rb

20 lines
597 B
Ruby

# frozen_string_literal: true
# add is_valid to slots_reservations
# remove validated_at from slots_reservations
class AddIsValidToSlotsReservations < ActiveRecord::Migration[7.0]
def up
add_column :slots_reservations, :is_valid, :boolean
SlotsReservation.reset_column_information
SlotsReservation.all.each do |sr|
sr.update_column(:is_valid, true) if sr.validated_at.present?
end
remove_column :slots_reservations, :validated_at
end
def down
remove_column :slots_reservations, :is_valid
add_column :slots_reservations, :validated_at, :datetime
end
end