class AddDataToProjectIssuesIndexsInIssue < ActiveRecord::Migration
  def change
    transaction do
      for i in 1 ... 1000 do i
        Issue.page(i).per(10).each do |e|
          index = e.project.issues.index(e).to_i + 1
          execute("update issues set project_issues_index = #{index} where id = #{e.id}")
        end
      end
    end
  end
end
