##// END OF EJS Templates
Added migration of Mantis bug monitors....
Jean-Philippe Lang -
r623:f179eee7a00d
parent child
Show More
@@ -133,6 +133,7 task :migrate_from_mantis => :environment do
133 133 belongs_to :bug_text, :class_name => "MantisBugText", :foreign_key => :bug_text_id
134 134 has_many :bug_notes, :class_name => "MantisBugNote", :foreign_key => :bug_id
135 135 has_many :bug_files, :class_name => "MantisBugFile", :foreign_key => :bug_id
136 has_many :bug_monitors, :class_name => "MantisBugMonitor", :foreign_key => :bug_id
136 137 end
137 138
138 139 class MantisBugText < ActiveRecord::Base
@@ -173,6 +174,10 task :migrate_from_mantis => :environment do
173 174 set_table_name :mantis_bug_relationship_table
174 175 end
175 176
177 class MantisBugMonitor < ActiveRecord::Base
178 set_table_name :mantis_bug_monitor_table
179 end
180
176 181 class MantisNews < ActiveRecord::Base
177 182 set_table_name :mantis_news_table
178 183 end
@@ -307,6 +312,11 task :migrate_from_mantis => :environment do
307 312 a.container = i
308 313 a.save
309 314 end
315
316 # Bug monitors
317 bug.bug_monitors.each do |monitor|
318 i.add_watcher(User.find_by_id(users_map[monitor.user_id]))
319 end
310 320 end
311 321 puts
312 322
@@ -320,6 +330,7 task :migrate_from_mantis => :environment do
320 330 pp r unless r.save
321 331 print '.'
322 332 end
333 puts
323 334
324 335 # News
325 336 print "Migrating news"
@@ -378,6 +389,7 task :migrate_from_mantis => :environment do
378 389 puts "Bug notes: #{Journal.count}/#{MantisBugNote.count}"
379 390 puts "Bug files: #{Attachment.count}/#{MantisBugFile.count}"
380 391 puts "Bug relations: #{IssueRelation.count}/#{MantisBugRelationship.count}"
392 puts "Bug monitors: #{Watcher.count}/#{MantisBugMonitor.count}"
381 393 puts "News: #{News.count}/#{MantisNews.count}"
382 394 puts "Custom fields: #{IssueCustomField.count}/#{MantisCustomField.count}"
383 395 end
General Comments 0
You need to be logged in to leave comments. Login now