Commit 2e5481b74663deddeda66ccd74eb7e38649cccb7
1 parent
7047a44a
Exists in
master
and in
4 other branches
Create task to create iid for existing issues/mr
Showing
1 changed file
with
31 additions
and
0 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | +desc "GITLAB | Build internal ids for issues and merge requests" | |
| 2 | +task migrate_iids: :environment do | |
| 3 | + puts 'Issues'.yellow | |
| 4 | + Issue.where(iid: nil).find_each(batch_size: 100) do |issue| | |
| 5 | + begin | |
| 6 | + issue.set_iid | |
| 7 | + if issue.save | |
| 8 | + print '.' | |
| 9 | + else | |
| 10 | + print 'F' | |
| 11 | + end | |
| 12 | + rescue | |
| 13 | + print 'F' | |
| 14 | + end | |
| 15 | + end | |
| 16 | + | |
| 17 | + puts 'done' | |
| 18 | + puts 'Merge Requests'.yellow | |
| 19 | + MergeRequest.where(iid: nil).find_each(batch_size: 100) do |mr| | |
| 20 | + begin | |
| 21 | + mr.set_iid | |
| 22 | + if mr.save | |
| 23 | + print '.' | |
| 24 | + else | |
| 25 | + print 'F' | |
| 26 | + end | |
| 27 | + rescue => ex | |
| 28 | + print 'F' | |
| 29 | + end | |
| 30 | + end | |
| 31 | +end | ... | ... |