class MigrateSubjectStatus < ActiveRecord::Migration[5.2]
  def change
    Subject.unhidden.visible.update_all(public: 2)
    Subject.where(status: 1, id: ApplyAction.where(container_type: 'ApplySubject', status: 0)
                                     .pluck(:container_id)).update_all(status: 2, public: 1)
  end
end
