diff --git a/db/migrate/20191203124903_add_index_to_exercise_choice.rb b/db/migrate/20191203124903_add_index_to_exercise_choice.rb index f5c8139b2..1babae48d 100644 --- a/db/migrate/20191203124903_add_index_to_exercise_choice.rb +++ b/db/migrate/20191203124903_add_index_to_exercise_choice.rb @@ -1,7 +1,5 @@ class AddIndexToExerciseChoice < ActiveRecord::Migration[5.2] def change - remove_index :exercise_answers, name: :index_on_question_id_user_id - change_column_default :exercise_answers, :exercise_choice_id, from: nil, to: -1 ExerciseAnswer.where(exercise_choice_id: nil).update_all(exercise_choice_id: -1) @@ -12,5 +10,7 @@ class AddIndexToExerciseChoice < ActiveRecord::Migration[5.2] add_index :exercise_answers, [:exercise_question_id, :user_id, :exercise_choice_id], name: 'exercise_choice_index', unique: true + remove_index :exercise_answers, name: :index_on_question_id_user_id + end end