class MigratePollBankQuestion < ActiveRecord::Migration[5.2] def change ExerciseBankQuestion.where(question_type: 0, exercise_bank_id: ExerciseBank.where(container_type: 'Poll').pluck(:id)).update_all(question_type: 1) ExerciseBankQuestion.where(question_type: 1, exercise_bank_id: ExerciseBank.where(container_type: 'Poll').pluck(:id)).update_all(question_type: 2) end end