class StaticsBoardsReply < ActiveRecord::Migration
  def up
    Project.all.each do |project|
      puts project.id
      unless project.boards.first.nil?
        messages_count = Message.where("board_id =? and parent_id is not ?", project.boards.first.id, nil).count
        project.update_attribute(:boards_reply_count, messages_count)
      end
    end
  end

  def down
  end
end
