summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-13 15:35:52 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-13 15:35:52 +0000
commitf179eee7a00d8eb84ffd19f306c08735dac50e11 (patch)
tree6466b31bcf7ba84a8c70ca25c4cec2fc9747b25f /lib
parent5b4812add8d93ea9d8705beac10072081e4cae9b (diff)
downloadredmine-f179eee7a00d8eb84ffd19f306c08735dac50e11.tar.gz
redmine-f179eee7a00d8eb84ffd19f306c08735dac50e11.zip
Added migration of Mantis bug monitors.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@626 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/migrate_from_mantis.rake12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/tasks/migrate_from_mantis.rake b/lib/tasks/migrate_from_mantis.rake
index 1a2d0877b..e571ae41e 100644
--- a/lib/tasks/migrate_from_mantis.rake
+++ b/lib/tasks/migrate_from_mantis.rake
@@ -133,6 +133,7 @@ task :migrate_from_mantis => :environment do
belongs_to :bug_text, :class_name => "MantisBugText", :foreign_key => :bug_text_id
has_many :bug_notes, :class_name => "MantisBugNote", :foreign_key => :bug_id
has_many :bug_files, :class_name => "MantisBugFile", :foreign_key => :bug_id
+ has_many :bug_monitors, :class_name => "MantisBugMonitor", :foreign_key => :bug_id
end
class MantisBugText < ActiveRecord::Base
@@ -173,6 +174,10 @@ task :migrate_from_mantis => :environment do
set_table_name :mantis_bug_relationship_table
end
+ class MantisBugMonitor < ActiveRecord::Base
+ set_table_name :mantis_bug_monitor_table
+ end
+
class MantisNews < ActiveRecord::Base
set_table_name :mantis_news_table
end
@@ -307,6 +312,11 @@ task :migrate_from_mantis => :environment do
a.container = i
a.save
end
+
+ # Bug monitors
+ bug.bug_monitors.each do |monitor|
+ i.add_watcher(User.find_by_id(users_map[monitor.user_id]))
+ end
end
puts
@@ -320,6 +330,7 @@ task :migrate_from_mantis => :environment do
pp r unless r.save
print '.'
end
+ puts
# News
print "Migrating news"
@@ -378,6 +389,7 @@ task :migrate_from_mantis => :environment do
puts "Bug notes: #{Journal.count}/#{MantisBugNote.count}"
puts "Bug files: #{Attachment.count}/#{MantisBugFile.count}"
puts "Bug relations: #{IssueRelation.count}/#{MantisBugRelationship.count}"
+ puts "Bug monitors: #{Watcher.count}/#{MantisBugMonitor.count}"
puts "News: #{News.count}/#{MantisNews.count}"
puts "Custom fields: #{IssueCustomField.count}/#{MantisCustomField.count}"
end