Commit 0da5a4fab136158f9a51de1f92f74ebd9ea922a2

Authored by Dmitriy Zaporozhets
1 parent 10902c84

separate rake task for migration and persistent one

lib/tasks/gitlab/migrate_wiki.rake
... ... @@ -1,42 +0,0 @@
1   -namespace :gitlab do
2   - namespace :wiki do
3   -
4   - # This task will migrate all of the existing Wiki
5   - # content stored in your database into the new
6   - # Gollum Wiki system. A new repository named
7   - # namespace/project.wiki.git will be created for
8   - # each project that currently has Wiki pages in
9   - # the database.
10   - #
11   - # Notes:
12   - # * The existing Wiki content will remain in your
13   - # database in-tact.
14   - desc "GITLAB | Migrate Wiki content from database to Gollum repositories."
15   - task :migrate => :environment do
16   - wiki_migrator = WikiToGollumMigrator.new
17   - wiki_migrator.migrate!
18   - end
19   -
20   - # This task will destroy all of the Wiki repos
21   - # that the Wiki migration task created. Run this
22   - # to clean up your environment if you experienced
23   - # problems during the original migration. After
24   - # executing this task, you can attempt the original
25   - # migration again.
26   - #
27   - # Notes:
28   - # * This will not affect Wikis that have been created
29   - # as Gollum Wikis only. It will only remove the wikis
30   - # for the repositories that have old Wiki data in the
31   - # dataabase.
32   - # * If you have any repositories already named
33   - # namespace/project.wiki that you do not wish
34   - # to be removed you may want to perform a manual
35   - # cleanup instead.
36   - desc "GITLAB | Remove the Wiki repositories created by the `gitlab:wiki:migrate` task."
37   - task :rollback => :environment do
38   - wiki_migrator = WikiToGollumMigrator.new
39   - wiki_migrator.rollback!
40   - end
41   - end
42   -end
lib/tasks/migrate/migrate_mr.rake 0 → 100644
... ... @@ -0,0 +1,11 @@
  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 + MergeRequest.find_each(batch_size: 20) do |mr|
  5 + mr.st_commits = []
  6 + mr.save
  7 + mr.reload_code
  8 + print '.'
  9 + end
  10 +end
  11 +
... ...
lib/tasks/migrate/migrate_wiki.rake 0 → 100644
... ... @@ -0,0 +1,42 @@
  1 +namespace :gitlab do
  2 + namespace :wiki do
  3 +
  4 + # This task will migrate all of the existing Wiki
  5 + # content stored in your database into the new
  6 + # Gollum Wiki system. A new repository named
  7 + # namespace/project.wiki.git will be created for
  8 + # each project that currently has Wiki pages in
  9 + # the database.
  10 + #
  11 + # Notes:
  12 + # * The existing Wiki content will remain in your
  13 + # database in-tact.
  14 + desc "GITLAB | Migrate Wiki content from database to Gollum repositories."
  15 + task :migrate => :environment do
  16 + wiki_migrator = WikiToGollumMigrator.new
  17 + wiki_migrator.migrate!
  18 + end
  19 +
  20 + # This task will destroy all of the Wiki repos
  21 + # that the Wiki migration task created. Run this
  22 + # to clean up your environment if you experienced
  23 + # problems during the original migration. After
  24 + # executing this task, you can attempt the original
  25 + # migration again.
  26 + #
  27 + # Notes:
  28 + # * This will not affect Wikis that have been created
  29 + # as Gollum Wikis only. It will only remove the wikis
  30 + # for the repositories that have old Wiki data in the
  31 + # dataabase.
  32 + # * If you have any repositories already named
  33 + # namespace/project.wiki that you do not wish
  34 + # to be removed you may want to perform a manual
  35 + # cleanup instead.
  36 + desc "GITLAB | Remove the Wiki repositories created by the `gitlab:wiki:migrate` task."
  37 + task :rollback => :environment do
  38 + wiki_migrator = WikiToGollumMigrator.new
  39 + wiki_migrator.rollback!
  40 + end
  41 + end
  42 +end
... ...