summaryrefslogtreecommitdiffstats
path: root/lib/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/migrate_from_mantis.rake14
-rw-r--r--lib/tasks/migrate_from_trac.rake12
2 files changed, 13 insertions, 13 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|
diff --git a/lib/tasks/migrate_from_trac.rake b/lib/tasks/migrate_from_trac.rake
index dcdd8f0f0..1c7b7bb38 100644
--- a/lib/tasks/migrate_from_trac.rake
+++ b/lib/tasks/migrate_from_trac.rake
@@ -61,7 +61,7 @@ namespace :redmine do
'patch' =>TRACKER_FEATURE
}
- 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
@@ -390,7 +390,7 @@ namespace :redmine do
# Components
print "Migrating components"
issues_category_map = {}
- TracComponent.find(:all).each do |component|
+ TracComponent.all.each do |component|
print '.'
STDOUT.flush
c = IssueCategory.new :project => @target_project,
@@ -404,7 +404,7 @@ namespace :redmine do
# Milestones
print "Migrating milestones"
version_map = {}
- TracMilestone.find(:all).each do |milestone|
+ TracMilestone.all.each do |milestone|
print '.'
STDOUT.flush
# First we try to find the wiki page...
@@ -443,7 +443,7 @@ namespace :redmine do
:field_format => 'string')
next if f.new_record?
- f.trackers = Tracker.find(:all)
+ f.trackers = Tracker.all
f.projects << @target_project
custom_field_map[field.name] = f
end
@@ -454,7 +454,7 @@ namespace :redmine do
r = IssueCustomField.new(:name => 'Resolution',
:field_format => 'list',
:is_filter => true) if r.nil?
- r.trackers = Tracker.find(:all)
+ r.trackers = Tracker.all
r.projects << @target_project
r.possible_values = (r.possible_values + %w(fixed invalid wontfix duplicate worksforme)).flatten.compact.uniq
r.save!
@@ -549,7 +549,7 @@ namespace :redmine do
# Wiki
print "Migrating wiki"
if wiki.save
- TracWikiPage.find(:all, :order => 'name, version').each do |page|
+ TracWikiPage.order('name, version').all.each do |page|
# Do not migrate Trac manual wiki pages
next if TRAC_WIKI_PAGES.include?(page.name)
wiki_edit_count += 1