class Modify1WechatSupportForShixuns < ActiveRecord::Migration[5.2]
  def change
      shixuns = Shixun.joins(:challenges).where(is_wechat_support: true, status: 2)
                    .select("shixuns.*, challenges.path path")
      shixuns.each do |shixun|
        if shixun.path && shixun.path.split("；").count > 1
          shixun.update_attribute(:is_wechat_support, false)
        end
      end
      Shixun.joins(:challenges).where(challenges: {st: 1}).update_all(is_wechat_support: false)

  end
end
