gitlab-org--gitlab-foss/db/migrate/20140502125220_migrate_repo_size.rb
Dmitriy Zaporozhets d10b34a685
Save repository size to projects table
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-05-02 16:05:08 +03:00

21 lines
388 B
Ruby

class MigrateRepoSize < ActiveRecord::Migration
def up
Project.reset_column_information
Project.find_each(batch_size: 500) do |project|
begin
if project.empty_repo?
print '-'
else
project.update_repository_size
print '.'
end
rescue
print 'F'
end
end
puts 'Done'
end
def down
end
end