socialforge/db/migrate/20170302073836_add_column_t...

11 lines
321 B
Ruby

class AddColumnToExercise < ActiveRecord::Migration
def change
add_column :exercise_users, :objective_score, :integer, :default => -1
add_column :exercise_users, :subjective_score, :integer, :default => -1
ExerciseUser.all.each do |eu|
eu.update_column('objective_score', eu.score)
end
end
end