summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Atkins <tatkins@gitlab.com>2019-06-11 14:34:09 +0000
committerTom Atkins <tatkins@gitlab.com>2019-06-11 14:34:09 +0000
commitf813e9016daa33c82d261a8729c957d670fee0f3 (patch)
tree8cd38926f40b9141c83d9bbebe633a5decb0e0ed
parent0803dd645369c7c82e0992160fe961a9e8e45107 (diff)
parent6db897799e5cbd8ac1e03ab347b8772018885b4e (diff)
downloadgitlab-ce-f813e9016daa33c82d261a8729c957d670fee0f3.tar.gz
Merge branch 'docs-bulk-migrate-issues' into 'master'
Adding documentation on how to bulk migrate issues See merge request gitlab-org/gitlab-ce!24530
-rw-r--r--doc/user/project/issues/moving_issues.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/user/project/issues/moving_issues.md b/doc/user/project/issues/moving_issues.md
index 211a651b89e..8aac2c01444 100644
--- a/doc/user/project/issues/moving_issues.md
+++ b/doc/user/project/issues/moving_issues.md
@@ -8,3 +8,28 @@ There will also be a system note added to both issues indicating where it came f
You can move an issue with the "Move issue" button at the bottom of the right-sidebar when viewing the issue.
![move issue - button](img/sidebar_move_issue.png)
+
+## Troubleshooting
+
+### Moving Issues in Bulk
+
+If you have advanced technical skills you can also bulk move all the issues from one project to another in the rails console. The below script will move all the issues from one project to another that are not in status **closed**.
+
+To access rails console run `sudo gitlab-rails console` on the GitLab server and run the below script. Please be sure to change **project**, **admin_user** and **target_project** to your values. We do also recommend [creating a backup](https://docs.gitlab.com/ee/raketasks/backup_restore.html#creating-a-backup-of-the-gitlab-system) before attempting any changes in the console.
+
+```ruby
+project = Project.find_by_full_path('full path of the project where issues are moved from')
+issues = project.issues
+admin_user = User.find_by_username('username of admin user') # make sure user has permissions to move the issues
+target_project = Project.find_by_full_path('full path of target project where issues moved to')
+
+issues.each do |issue|
+ if issue.state != "closed" && issue.moved_to.nil?
+ Issues::MoveService.new(project, admin_user).execute(issue, target_project)
+ else
+ puts "issue with id: #{issue.id} and title: #{issue.title} was not moved"
+ end
+end; nil
+
+```
+