socialforge/db/migrate/20150829130302_update_forge...

28 lines
923 B
Ruby

class UpdateForgeMessageTime < ActiveRecord::Migration
def up
# forge_count = ForgeMessage.all.count / 30 + 1
# transaction do
# for i in 1 ... forge_count do i
# ForgeMessage.page(i).per(30).each do |fmessage|
# if fmessage.forge_message
# if fmessage.forge_message.respond_to?("created_at")
# fmessage.created_at = fmessage.forge_message.created_at
# elsif fmessage.forge_message.respond_to?("created_on")
# fmessage.created_at = fmessage.forge_message.created_on
# end
# fmessage.save
# puts fmessage.id
#
# forge_all_message = MessageAll.where("message_type = '#{fmessage.class.to_s}' and message_id = '#{fmessage.id}'").first
# forge_all_message.created_at = fmessage.created_at
# forge_all_message.save
# end
# end
# end
# end
end
def down
end
end