diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-19 23:11:18 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-19 23:11:18 +0400 |
commit | 2e5481b74663deddeda66ccd74eb7e38649cccb7 (patch) | |
tree | 579adf09b012dda02bc99762af12f39339f7f7a5 /lib/tasks/migrate | |
parent | 7047a44a26f0f75ab23c58c47d096060c01256ed (diff) |
Create task to create iid for existing issues/mr
Diffstat (limited to 'lib/tasks/migrate')
-rw-r--r-- | lib/tasks/migrate/migrate_iids.rake | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/tasks/migrate/migrate_iids.rake b/lib/tasks/migrate/migrate_iids.rake new file mode 100644 index 00000000000..4d2d49dd6d8 --- /dev/null +++ b/lib/tasks/migrate/migrate_iids.rake @@ -0,0 +1,31 @@ +desc "GITLAB | Build internal ids for issues and merge requests" +task migrate_iids: :environment do + puts 'Issues'.yellow + Issue.where(iid: nil).find_each(batch_size: 100) do |issue| + begin + issue.set_iid + if issue.save + print '.' + else + print 'F' + end + rescue + print 'F' + end + end + + puts 'done' + puts 'Merge Requests'.yellow + MergeRequest.where(iid: nil).find_each(batch_size: 100) do |mr| + begin + mr.set_iid + if mr.save + print '.' + else + print 'F' + end + rescue => ex + print 'F' + end + end +end |