summaryrefslogtreecommitdiffstats
path: root/lib/tasks/migrate_from_mantis.rake
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-02 20:23:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-02 20:23:48 +0000
commit536747b74708188848d85d8de5df34e7aa762006 (patch)
treec7cfe03314c047dff313825c8548d056e5e1af29 /lib/tasks/migrate_from_mantis.rake
parent96fca0b08f6d60e8736e8e3f95a5d0ae33779068 (diff)
downloadredmine-536747b74708188848d85d8de5df34e7aa762006.tar.gz
redmine-536747b74708188848d85d8de5df34e7aa762006.zip
Replaces find(:all) calls.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10917 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/tasks/migrate_from_mantis.rake')
-rw-r--r--lib/tasks/migrate_from_mantis.rake14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/tasks/migrate_from_mantis.rake b/lib/tasks/migrate_from_mantis.rake
index 7570e820a..02ce9f472 100644
--- a/lib/tasks/migrate_from_mantis.rake
+++ b/lib/tasks/migrate_from_mantis.rake
@@ -53,7 +53,7 @@ task :migrate_from_mantis => :environment do
TRACKER_BUG = Tracker.find_by_position(1)
TRACKER_FEATURE = Tracker.find_by_position(2)
- roles = Role.find(:all, :conditions => {:builtin => 0}, :order => 'position ASC')
+ roles = Role.where(:builtin => 0).order('position ASC').all
manager_role = roles[0]
developer_role = roles[1]
DEFAULT_ROLE = roles.last
@@ -241,7 +241,7 @@ task :migrate_from_mantis => :environment do
User.delete_all "login <> 'admin'"
users_map = {}
users_migrated = 0
- MantisUser.find(:all).each do |user|
+ MantisUser.all.each do |user|
u = User.new :firstname => encode(user.firstname),
:lastname => encode(user.lastname),
:mail => user.email,
@@ -263,7 +263,7 @@ task :migrate_from_mantis => :environment do
projects_map = {}
versions_map = {}
categories_map = {}
- MantisProject.find(:all).each do |project|
+ MantisProject.all.each do |project|
p = Project.new :name => encode(project.name),
:description => encode(project.description)
p.identifier = project.identifier
@@ -365,7 +365,7 @@ task :migrate_from_mantis => :environment do
# Bug relationships
print "Migrating bug relations"
- MantisBugRelationship.find(:all).each do |relation|
+ MantisBugRelationship.all.each do |relation|
next unless issues_map[relation.source_bug_id] && issues_map[relation.destination_bug_id]
r = IssueRelation.new :relation_type => RELATION_TYPE_MAPPING[relation.relationship_type]
r.issue_from = Issue.find_by_id(issues_map[relation.source_bug_id])
@@ -379,7 +379,7 @@ task :migrate_from_mantis => :environment do
# News
print "Migrating news"
News.destroy_all
- MantisNews.find(:all, :conditions => 'project_id > 0').each do |news|
+ MantisNews.where('project_id > 0').all.each do |news|
next unless projects_map[news.project_id]
n = News.new :project_id => projects_map[news.project_id],
:title => encode(news.headline[0..59]),
@@ -395,7 +395,7 @@ task :migrate_from_mantis => :environment do
# Custom fields
print "Migrating custom fields"
IssueCustomField.destroy_all
- MantisCustomField.find(:all).each do |field|
+ MantisCustomField.all.each do |field|
f = IssueCustomField.new :name => field.name[0..29],
:field_format => CUSTOM_FIELD_TYPE_MAPPING[field.format],
:min_length => field.length_min,
@@ -407,7 +407,7 @@ task :migrate_from_mantis => :environment do
print '.'
STDOUT.flush
# Trackers association
- f.trackers = Tracker.find :all
+ f.trackers = Tracker.all
# Projects association
field.projects.each do |project|