Commit 3cc26654d576ed6a0f6eb33980c41f1b66b5f1eb

Authored by Dmitriy Zaporozhets
1 parent 6b206c9d

Remove old migration tasks

You should update to 6.0 before proceed with update to higher version.
So its no reason to keep old tasks any more.
It should be still available in 6-0-stable but not in master
lib/tasks/migrate/migrate_global_projects.rake
... ... @@ -1,23 +0,0 @@
1   -desc "GITLAB | Migrate Global Projects to Namespaces"
2   -task migrate_global_projects: :environment do
3   - found = Project.where(namespace_id: nil).count
4   - if found > 0
5   - puts "Global namespace is deprecated. We found #{found} projects stored in global namespace".yellow
6   - puts "You may abort this task and move them to group/user namespaces manually."
7   - puts "If you want us to move this projects under owner namespaces then continue"
8   - ask_to_continue
9   - else
10   - puts "No global projects found. Proceed with update.".green
11   - end
12   -
13   - Project.where(namespace_id: nil).find_each(batch_size: 20) do |project|
14   - begin
15   - project.transfer(project.owner.namespace)
16   - print '.'
17   - rescue => ex
18   - puts ex.message
19   - print 'F'
20   - end
21   - end
22   -end
23   -
lib/tasks/migrate/migrate_groups.rake
... ... @@ -1,16 +0,0 @@
1   -desc "GITLAB | Migrate Groups to match v6.0"
2   -task migrate_groups: :environment do
3   - puts "This will add group owners to group membership"
4   - ask_to_continue
5   -
6   - Group.find_each(batch_size: 20) do |group|
7   - begin
8   - group.send :add_owner
9   - print '.'
10   - rescue => ex
11   - puts ex.message
12   - print 'F'
13   - end
14   - end
15   -end
16   -
lib/tasks/migrate/migrate_inline_notes.rake
... ... @@ -1,16 +0,0 @@
1   -desc "GITLAB | Migrate inline notes"
2   -task migrate_inline_notes: :environment do
3   - Note.where('line_code IS NOT NULL').find_each(batch_size: 100) do |note|
4   - begin
5   - note.set_diff
6   - if note.save
7   - print '.'
8   - else
9   - print 'F'
10   - end
11   - rescue
12   - print 'F'
13   - end
14   - end
15   -end
16   -
lib/tasks/migrate/migrate_keys.rake
... ... @@ -1,20 +0,0 @@
1   -desc "GITLAB | Migrate SSH Keys"
2   -task migrate_keys: :environment do
3   - puts "This will add fingerprint to ssh keys in db"
4   - puts "If you have duplicate keys https://github.com/gitlabhq/gitlabhq/issues/4453 all but the first will be deleted".yellow
5   - ask_to_continue
6   -
7   - Key.find_each(batch_size: 20) do |key|
8   - if key.valid? && key.save
9   - print '.'
10   - elsif key.fingerprint.present?
11   - puts "\nDeleting #{key.inspect}".yellow
12   - key.destroy
13   - else
14   - print 'F'
15   - end
16   - end
17   - print "\n"
18   -end
19   -
20   -
lib/tasks/migrate/migrate_milestones.rake
... ... @@ -1,4 +0,0 @@
1   -desc "GITLAB | Migrate Milestones"
2   -task migrate_milestones: :environment do
3   - Milestone.where(state: nil).update_all(state: 'active')
4   -end
lib/tasks/migrate/migrate_mr.rake
... ... @@ -1,18 +0,0 @@
1   -# This taks will reload commits/diff for all merge requests
2   -desc "GITLAB | Migrate Merge Requests"
3   -task migrate_merge_requests: :environment do
4   - puts "Since 5.1 old merge request serialization logic was replaced with a better one."
5   - puts "It makes old merge request diff invalid for GitLab 5.1+"
6   - puts "* * *"
7   - puts "This will rebuild commits/diffs info for existing merge requests."
8   - puts "You will lose merge request diff if its already merged."
9   - ask_to_continue
10   -
11   - MergeRequest.find_each(batch_size: 20) do |mr|
12   - mr.st_commits = []
13   - mr.save
14   - mr.reload_code
15   - print '.'
16   - end
17   -end
18   -
lib/tasks/migrate/migrate_note_linecode.rake
... ... @@ -1,13 +0,0 @@
1   -desc "GITLAB | Migrate Note LineCode"
2   -task migrate_note_linecode: :environment do
3   - Note.inline.each do |note|
4   - index = note.diff_file_index
5   - if index =~ /^\d{1,10}$/ # is number. not hash.
6   - hash = Digest::SHA1.hexdigest(note.noteable.diffs[index.to_i].new_path)
7   - new_line_code = note.line_code.sub(index, hash)
8   - note.update_column :line_code, new_line_code
9   - print '.'
10   - end
11   - end
12   -end
13   -