class ChangeExerciseScoreToFloat < ActiveRecord::Migration[5.2]
  def up
    change_column :exercise_users,:score,:decimal,precision: 10, scale: 1
    change_column :exercise_users, :objective_score, :decimal,precision: 10, scale: 1,default: 0.0
    # change_column :exercise_users, :subjective_score, :decimal,precision: 10, scale: 1,default: 0.0
    change_column :exercise_users, :subjective_score, :decimal,precision: 10, scale: 1,default: -1.0
    # change_column :exercise_answers,:score,:decimal,precision: 10, scale: 1,default: 0.0
    change_column :exercise_answers,:score,:decimal,precision: 10, scale: 1,default: -1.0    #6.10修改，方便判断主观题是否批阅
    change_column :exercise_bank_questions,:question_score,:decimal,precision: 10, scale: 1
    change_column :exercise_bank_shixun_challenges,:question_score,:decimal,precision: 10, scale: 1
    change_column :exercise_questions,:question_score,:decimal,precision: 10, scale: 1
    change_column :exercise_shixun_answers,:score,:decimal,precision: 10, scale: 1
    change_column :exercise_shixun_challenges,:question_score,:decimal,precision: 10, scale: 1
    change_column :exercise_answer_comments, :score,:decimal,precision: 10, scale: 1
  end

  def down
    change_column :exercise_users,:score,:integer
    change_column :exercise_users, :objective_score, :integer,default: -1
    change_column :exercise_users, :subjective_score, :integer,default: -1
    change_column :exercise_answers,:score,:integer,default: -1
    change_column :exercise_bank_questions,:question_score,:integer
    change_column :exercise_shixun_answers,:score,:integer
    change_column :exercise_bank_shixun_challenges,:question_score,:integer
    change_column :exercise_questions,:question_score,:integer
    change_column :exercise_shixun_challenges,:question_score,:integer
    change_column :exercise_answer_comments, :score,:integer
  end
end
