Sha256: 6065adbc066c87ab3fab678cbcd7efa2769ccd11b6538d071280eced7dd5c4c3
Contents?: true
Size: 816 Bytes
Versions: 17
Compression:
Stored size: 816 Bytes
Contents
class AddExtendedAttributesToTickets < ActiveRecord::Migration def up add_column :tickets, :extended_attributes, :hstore Ticket.reset_column_information Ticket.nosync do Ticket.unscoped.find_each do |ticket| if ticket.project.nil? ticket.delete next end attrs = {} unless ticket.estimated_effort.blank? or ticket.estimated_effort.zero? attrs["estimated_effort"] = ticket.estimated_effort end unless ticket.estimated_value.blank? or ticket.estimated_value.zero? attrs["estimated_value"] = ticket.estimated_value end ticket.update_attribute(:extended_attributes, attrs) unless attrs.empty? end end end def down remove_column :tickets, :extended_attributes end end
Version data entries
17 entries across 17 versions & 1 rubygems