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

14 lines
348 B
Ruby
Raw Normal View History

# frozen_string_literal:true
class AddTrainingCreditNbToPlan < ActiveRecord::Migration[4.2]
2016-03-23 18:39:41 +01:00
def change
add_column :plans, :training_credit_nb, :integer
if Plan.column_names.include? "training_credit_nb"
Plan.all.each do |p|
p.update_columns(training_credit_nb: (p.interval == 'month' ? 1 : 5))
end
end
end
end