##// 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 belongs_to :bug_text, :class_name => "MantisBugText", :foreign_key => :bug_text_id
133 belongs_to :bug_text, :class_name => "MantisBugText", :foreign_key => :bug_text_id
134 has_many :bug_notes, :class_name => "MantisBugNote", :foreign_key => :bug_id
134 has_many :bug_notes, :class_name => "MantisBugNote", :foreign_key => :bug_id
135 has_many :bug_files, :class_name => "MantisBugFile", :foreign_key => :bug_id
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 end
137 end
137
138
138 class MantisBugText < ActiveRecord::Base
139 class MantisBugText < ActiveRecord::Base
@@ -173,6 +174,10 task :migrate_from_mantis => :environment do
173 set_table_name :mantis_bug_relationship_table
174 set_table_name :mantis_bug_relationship_table
174 end
175 end
175
176
177 class MantisBugMonitor < ActiveRecord::Base
178 set_table_name :mantis_bug_monitor_table
179 end
180
176 class MantisNews < ActiveRecord::Base
181 class MantisNews < ActiveRecord::Base
177 set_table_name :mantis_news_table
182 set_table_name :mantis_news_table
178 end
183 end
@@ -307,6 +312,11 task :migrate_from_mantis => :environment do
307 a.container = i
312 a.container = i
308 a.save
313 a.save
309 end
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 end
320 end
311 puts
321 puts
312
322
@@ -320,6 +330,7 task :migrate_from_mantis => :environment do
320 pp r unless r.save
330 pp r unless r.save
321 print '.'
331 print '.'
322 end
332 end
333 puts
323
334
324 # News
335 # News
325 print "Migrating news"
336 print "Migrating news"
@@ -378,6 +389,7 task :migrate_from_mantis => :environment do
378 puts "Bug notes: #{Journal.count}/#{MantisBugNote.count}"
389 puts "Bug notes: #{Journal.count}/#{MantisBugNote.count}"
379 puts "Bug files: #{Attachment.count}/#{MantisBugFile.count}"
390 puts "Bug files: #{Attachment.count}/#{MantisBugFile.count}"
380 puts "Bug relations: #{IssueRelation.count}/#{MantisBugRelationship.count}"
391 puts "Bug relations: #{IssueRelation.count}/#{MantisBugRelationship.count}"
392 puts "Bug monitors: #{Watcher.count}/#{MantisBugMonitor.count}"
381 puts "News: #{News.count}/#{MantisNews.count}"
393 puts "News: #{News.count}/#{MantisNews.count}"
382 puts "Custom fields: #{IssueCustomField.count}/#{MantisCustomField.count}"
394 puts "Custom fields: #{IssueCustomField.count}/#{MantisCustomField.count}"
383 end
395 end
General Comments 0
You need to be logged in to leave comments. Login now