summaryrefslogtreecommitdiff
path: root/lib/tasks/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks/migrate')
-rw-r--r--lib/tasks/migrate/migrate_iids.rake33
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