2015-06-23 10:52:40 -04:00
|
|
|
desc "GitLab | Build internal ids for issues and merge requests"
|
2013-08-19 15:11:18 -04:00
|
|
|
task migrate_iids: :environment do
|
2016-06-01 18:37:15 -04:00
|
|
|
puts 'Issues'.color(:yellow)
|
2013-08-19 15:11:18 -04:00
|
|
|
Issue.where(iid: nil).find_each(batch_size: 100) do |issue|
|
|
|
|
begin
|
|
|
|
issue.set_iid
|
2018-01-11 11:34:01 -05:00
|
|
|
|
2013-08-20 15:41:05 -04:00
|
|
|
if issue.update_attribute(:iid, issue.iid)
|
2013-08-19 15:11:18 -04:00
|
|
|
print '.'
|
|
|
|
else
|
|
|
|
print 'F'
|
|
|
|
end
|
|
|
|
rescue
|
|
|
|
print 'F'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
puts 'done'
|
2016-06-01 18:37:15 -04:00
|
|
|
puts 'Merge Requests'.color(:yellow)
|
2013-08-19 15:11:18 -04:00
|
|
|
MergeRequest.where(iid: nil).find_each(batch_size: 100) do |mr|
|
|
|
|
begin
|
|
|
|
mr.set_iid
|
2018-01-11 11:34:01 -05:00
|
|
|
|
2013-08-19 15:53:11 -04:00
|
|
|
if mr.update_attribute(:iid, mr.iid)
|
2013-08-19 15:11:18 -04:00
|
|
|
print '.'
|
|
|
|
else
|
|
|
|
print 'F'
|
|
|
|
end
|
2017-02-22 13:18:40 -05:00
|
|
|
rescue
|
2013-08-19 15:11:18 -04:00
|
|
|
print 'F'
|
|
|
|
end
|
|
|
|
end
|
2013-08-19 15:53:11 -04:00
|
|
|
|
2013-08-21 05:16:26 -04:00
|
|
|
puts 'done'
|
2016-06-01 18:37:15 -04:00
|
|
|
puts 'Milestones'.color(:yellow)
|
2013-08-21 05:16:26 -04:00
|
|
|
Milestone.where(iid: nil).find_each(batch_size: 100) do |m|
|
|
|
|
begin
|
|
|
|
m.set_iid
|
2018-01-11 11:34:01 -05:00
|
|
|
|
2013-08-21 05:16:26 -04:00
|
|
|
if m.update_attribute(:iid, m.iid)
|
|
|
|
print '.'
|
|
|
|
else
|
|
|
|
print 'F'
|
|
|
|
end
|
|
|
|
rescue
|
|
|
|
print 'F'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-08-19 15:53:11 -04:00
|
|
|
puts 'done'
|
2013-08-19 15:11:18 -04:00
|
|
|
end
|