educoder/db/migrate/20190427045904_update_exerc...

8 lines
426 B

6 years ago
class UpdateExerciseDefaultValue < ActiveRecord::Migration[5.2]
def change
ExerciseUser.where(objective_score: -1.0).update_all(objective_score: 0.0)
# ExerciseUser.where(subjective_score: -1.0).update_all(subjective_score: 0.0) #主观题默认分数为-1不需修改
# ExerciseAnswer.where(score: -1.0).update_all(score: 0.0) #6.10 修改,方便判断主观题是否
end
end