class StaticsRepositoryCommits < ActiveRecord::Migration
  def up
    g = Gitlab.client
    Project.all.each do |project|
      unless project.gpid.nil?
        begin
          puts project.id
          count = g.project(project.gpid).commit_count
        rescue
          logger.error("The project's rep is not exit!")
        end
        project.update_attribute(:commits_count, count)
      end
    end
  end

  def down
  end
end
