belongs_to :bug_text, :class_name => "MantisBugText", :foreign_key => :bug_text_id\r
has_many :bug_notes, :class_name => "MantisBugNote", :foreign_key => :bug_id\r
has_many :bug_files, :class_name => "MantisBugFile", :foreign_key => :bug_id\r
+ has_many :bug_monitors, :class_name => "MantisBugMonitor", :foreign_key => :bug_id\r
end\r
\r
class MantisBugText < ActiveRecord::Base\r
set_table_name :mantis_bug_relationship_table\r
end\r
\r
+ class MantisBugMonitor < ActiveRecord::Base\r
+ set_table_name :mantis_bug_monitor_table\r
+ end\r
+ \r
class MantisNews < ActiveRecord::Base\r
set_table_name :mantis_news_table\r
end\r
a.container = i\r
a.save\r
end\r
+ \r
+ # Bug monitors\r
+ bug.bug_monitors.each do |monitor|\r
+ i.add_watcher(User.find_by_id(users_map[monitor.user_id]))\r
+ end\r
end\r
puts\r
\r
pp r unless r.save\r
print '.'\r
end\r
+ puts\r
\r
# News\r
print "Migrating news"\r
puts "Bug notes: #{Journal.count}/#{MantisBugNote.count}"\r
puts "Bug files: #{Attachment.count}/#{MantisBugFile.count}"\r
puts "Bug relations: #{IssueRelation.count}/#{MantisBugRelationship.count}"\r
+ puts "Bug monitors: #{Watcher.count}/#{MantisBugMonitor.count}"\r
puts "News: #{News.count}/#{MantisNews.count}"\r
puts "Custom fields: #{IssueCustomField.count}/#{MantisCustomField.count}"\r
end\r