From f179eee7a00d8eb84ffd19f306c08735dac50e11 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 13 Aug 2007 15:35:52 +0000 Subject: [PATCH] Added migration of Mantis bug monitors. git-svn-id: http://redmine.rubyforge.org/svn/trunk@626 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/tasks/migrate_from_mantis.rake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/tasks/migrate_from_mantis.rake b/lib/tasks/migrate_from_mantis.rake index 1a2d0877..e571ae41 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 -- 2.11.0