class ChangeDefaultDataForNameInBorads < ActiveRecord::Migration[5.2]
  def change
    puts "--------- START ------------"
    Board.roots.joins(:course).where('courses.id = boards.course_id').find_each do |board|
      board.update_columns(name: '讨论区') unless board.name.strip === '讨论区'
      puts "Board ID IS #{board.id}"
    end
    puts "--------- END ----------"
  end
end
