class MigrateCourseIsMd < ActiveRecord::Migration[5.2] def change # HomeworkCommon.where(homework_type: [1, 3]).where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false) # HomeworkBank.where(homework_type: [1, 3]).where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false) # # HomeworkCommon.where(homework_type: [1, 3]).where("created_at >= '2019-07-21 00:00:00' and homework_bank_id is not null").each do |homework| # # end # # ExerciseQuestion.where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false) # PollQuestion.where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false) # ExerciseBankQuestion.where("created_at < '2019-07-21 00:00:00'").update_all(is_md: false) end end