迁移调整

dev_forge
cxt 5 years ago
parent 6938639d0d
commit 5845e3749b

@ -1,6 +1,6 @@
class AddIndexToExerciseChoice < ActiveRecord::Migration[5.2] class AddIndexToExerciseChoice < ActiveRecord::Migration[5.2]
def change def change
remove_index :exercise_answers, column: [:exercise_question_id, :user_id] remove_index :exercise_answers, name: :index_on_question_id_user_id
change_column_default :exercise_answers, :exercise_choice_id, from: nil, to: -1 change_column_default :exercise_answers, :exercise_choice_id, from: nil, to: -1
ExerciseAnswer.where(exercise_choice_id: nil).update_all(exercise_choice_id: -1) ExerciseAnswer.where(exercise_choice_id: nil).update_all(exercise_choice_id: -1)

Loading…
Cancel
Save