From 27916c5d4e9946f368f777f18e2669256bad5fef Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 3 Dec 2019 21:06:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20191203124903_add_index_to_exercise_choice.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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