diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-20 19:30:38 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-20 19:30:38 +0000 |
commit | 395f3a1d20eb250992629054ddaf1b22aaa899a1 (patch) | |
tree | 64190cd36bd933e4882cecd48dd1ea8a97cd8b0d /lib/tasks/migrate | |
parent | 4873034aa3ef847283a6ae1e89b185f820c6dd84 (diff) | |
parent | e9f1c39e7e258e58fa79a8646c3ad224119a0ae5 (diff) | |
download | gitlab-ce-395f3a1d20eb250992629054ddaf1b22aaa899a1.tar.gz |
Merge branch 'feature/internal_ids' of /home/git/repositories/gitlab/gitlabhq
Diffstat (limited to 'lib/tasks/migrate')
-rw-r--r-- | lib/tasks/migrate/migrate_iids.rake | 33 |
1 files changed, 33 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..aef2b319df9 --- /dev/null +++ b/lib/tasks/migrate/migrate_iids.rake @@ -0,0 +1,33 @@ +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.update_attribute(:iid, mr.iid) + 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.update_attribute(:iid, mr.iid) + print '.' + else + print 'F' + end + rescue => ex + print 'F' + end + end + + puts 'done' +end |