socialforge/db/migrate/20150901004812_update_memo_...

28 lines
906 B
Ruby
Raw Normal View History

class UpdateMemoMessageTime < ActiveRecord::Migration
2015-08-31 17:45:14 +08:00
def up
# memo_count = Memo.all.count / 30 + 1
# transaction do
# for i in 1 ... memo_count do i
# MemoMessage.page(i).per(30).each do |memo_message|
# if memo_message.memo
# if memo_message.memo.respond_to?("created_at")
# memo_message.created_at = memo_message.memo.created_at
# elsif memo_message.memo.respond_to?("created_on")
# memo_message.created_at = memo_message.memo.created_on
# end
# memo_message.save
# puts memo_message.id
#
# memo_messages = MessageAll.where("message_type = '#{memo_message.class.to_s}' and message_id = '#{memo_message.id}'").first
# memo_messages.created_at = memo_message.created_at
# memo_messages.save
# end
# end
# end
# end
2015-08-31 17:45:14 +08:00
end
def down
end
end