summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-08-10 21:35:03 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-08-10 21:35:03 +0000
commitab4873b83d6f62fa78fdf07da4de2f2f7e0d738d (patch)
tree5cfa4a327b2533446d8ac5ec012041e51cd1fe05
parent2fdf4426cd8f7437f03181a4f3091f239b47f6d6 (diff)
downloadredmine-ab4873b83d6f62fa78fdf07da4de2f2f7e0d738d.tar.gz
redmine-ab4873b83d6f62fa78fdf07da4de2f2f7e0d738d.zip
Quote ids for attachment association since Trac's attachment.id is varchar (#1759).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1728 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/tasks/migrate_from_trac.rake10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/tasks/migrate_from_trac.rake b/lib/tasks/migrate_from_trac.rake
index 50048634b..880964ff8 100644
--- a/lib/tasks/migrate_from_trac.rake
+++ b/lib/tasks/migrate_from_trac.rake
@@ -149,7 +149,10 @@ namespace :redmine do
# ticket changes: only migrate status changes and comments
has_many :changes, :class_name => "TracTicketChange", :foreign_key => :ticket
- has_many :attachments, :class_name => "TracAttachment", :foreign_key => :id, :conditions => "#{TracMigrate::TracAttachment.table_name}.type = 'ticket'"
+ has_many :attachments, :class_name => "TracAttachment",
+ :finder_sql => "SELECT DISTINCT attachment.* FROM #{TracMigrate::TracAttachment.table_name}" +
+ " WHERE #{TracMigrate::TracAttachment.table_name}.type = 'ticket'" +
+ ' AND #{TracMigrate::TracAttachment.table_name}.id = \'#{id}\''
has_many :customs, :class_name => "TracTicketCustom", :foreign_key => :ticket
def ticket_type
@@ -186,7 +189,10 @@ namespace :redmine do
set_table_name :wiki
set_primary_key :name
- has_many :attachments, :class_name => "TracAttachment", :foreign_key => :id, :conditions => "#{TracMigrate::TracAttachment.table_name}.type = 'wiki'"
+ has_many :attachments, :class_name => "TracAttachment",
+ :finder_sql => "SELECT DISTINCT attachment.* FROM #{TracMigrate::TracAttachment.table_name}" +
+ " WHERE #{TracMigrate::TracAttachment.table_name}.type = 'wiki'" +
+ ' AND #{TracMigrate::TracAttachment.table_name}.id = \'#{id}\''
def self.columns
# Hides readonly Trac field to prevent clash with AR readonly? method (Rails 2.0)