##// END OF EJS Templates
Quote ids for attachment association since Trac's attachment.id is varchar (#1759)....
Jean-Philippe Lang -
r1727:ab4873b83d6f
parent child
Show More
@@ -149,7 +149,10 namespace :redmine do
149
149
150 # ticket changes: only migrate status changes and comments
150 # ticket changes: only migrate status changes and comments
151 has_many :changes, :class_name => "TracTicketChange", :foreign_key => :ticket
151 has_many :changes, :class_name => "TracTicketChange", :foreign_key => :ticket
152 has_many :attachments, :class_name => "TracAttachment", :foreign_key => :id, :conditions => "#{TracMigrate::TracAttachment.table_name}.type = 'ticket'"
152 has_many :attachments, :class_name => "TracAttachment",
153 :finder_sql => "SELECT DISTINCT attachment.* FROM #{TracMigrate::TracAttachment.table_name}" +
154 " WHERE #{TracMigrate::TracAttachment.table_name}.type = 'ticket'" +
155 ' AND #{TracMigrate::TracAttachment.table_name}.id = \'#{id}\''
153 has_many :customs, :class_name => "TracTicketCustom", :foreign_key => :ticket
156 has_many :customs, :class_name => "TracTicketCustom", :foreign_key => :ticket
154
157
155 def ticket_type
158 def ticket_type
@@ -186,7 +189,10 namespace :redmine do
186 set_table_name :wiki
189 set_table_name :wiki
187 set_primary_key :name
190 set_primary_key :name
188
191
189 has_many :attachments, :class_name => "TracAttachment", :foreign_key => :id, :conditions => "#{TracMigrate::TracAttachment.table_name}.type = 'wiki'"
192 has_many :attachments, :class_name => "TracAttachment",
193 :finder_sql => "SELECT DISTINCT attachment.* FROM #{TracMigrate::TracAttachment.table_name}" +
194 " WHERE #{TracMigrate::TracAttachment.table_name}.type = 'wiki'" +
195 ' AND #{TracMigrate::TracAttachment.table_name}.id = \'#{id}\''
190
196
191 def self.columns
197 def self.columns
192 # Hides readonly Trac field to prevent clash with AR readonly? method (Rails 2.0)
198 # Hides readonly Trac field to prevent clash with AR readonly? method (Rails 2.0)
General Comments 0
You need to be logged in to leave comments. Login now