comparison lib/tasks/.svn/text-base/migrate_from_trac.rake.svn-base @ 118:b859cc0c4fa1 cannam

Merge from branch "redmine-1.1"
author Chris Cannam
date Thu, 13 Jan 2011 13:21:03 +0000
parents af80e5618e9b
children cd2282d2aa55
comparison
equal deleted inserted replaced
114:8a205cc048de 118:b859cc0c4fa1
165 # ticket changes: only migrate status changes and comments 165 # ticket changes: only migrate status changes and comments
166 has_many :changes, :class_name => "TracTicketChange", :foreign_key => :ticket 166 has_many :changes, :class_name => "TracTicketChange", :foreign_key => :ticket
167 has_many :attachments, :class_name => "TracAttachment", 167 has_many :attachments, :class_name => "TracAttachment",
168 :finder_sql => "SELECT DISTINCT attachment.* FROM #{TracMigrate::TracAttachment.table_name}" + 168 :finder_sql => "SELECT DISTINCT attachment.* FROM #{TracMigrate::TracAttachment.table_name}" +
169 " WHERE #{TracMigrate::TracAttachment.table_name}.type = 'ticket'" + 169 " WHERE #{TracMigrate::TracAttachment.table_name}.type = 'ticket'" +
170 ' AND #{TracMigrate::TracAttachment.table_name}.id = \'#{id}\'' 170 ' AND #{TracMigrate::TracAttachment.table_name}.id = \'#{TracMigrate::TracAttachment.connection.quote_string(id.to_s)}\''
171 has_many :customs, :class_name => "TracTicketCustom", :foreign_key => :ticket 171 has_many :customs, :class_name => "TracTicketCustom", :foreign_key => :ticket
172 172
173 def ticket_type 173 def ticket_type
174 read_attribute(:type) 174 read_attribute(:type)
175 end 175 end
205 set_primary_key :name 205 set_primary_key :name
206 206
207 has_many :attachments, :class_name => "TracAttachment", 207 has_many :attachments, :class_name => "TracAttachment",
208 :finder_sql => "SELECT DISTINCT attachment.* FROM #{TracMigrate::TracAttachment.table_name}" + 208 :finder_sql => "SELECT DISTINCT attachment.* FROM #{TracMigrate::TracAttachment.table_name}" +
209 " WHERE #{TracMigrate::TracAttachment.table_name}.type = 'wiki'" + 209 " WHERE #{TracMigrate::TracAttachment.table_name}.type = 'wiki'" +
210 ' AND #{TracMigrate::TracAttachment.table_name}.id = \'#{id}\'' 210 ' AND #{TracMigrate::TracAttachment.table_name}.id = \'#{TracMigrate::TracAttachment.connection.quote_string(id.to_s)}\''
211 211
212 def self.columns 212 def self.columns
213 # Hides readonly Trac field to prevent clash with AR readonly? method (Rails 2.0) 213 # Hides readonly Trac field to prevent clash with AR readonly? method (Rails 2.0)
214 super.select {|column| column.name.to_s != 'readonly'} 214 super.select {|column| column.name.to_s != 'readonly'}
215 end 215 end