socialforge/db/migrate/20151224090313_delete_journ...

18 lines
386 B
Ruby
Raw Normal View History

2015-12-25 10:13:29 +08:00
class DeleteJournalsMessage < ActiveRecord::Migration
def up
count = JournalsForMessage.all.count / 30 + 2
transaction do
for i in 1 ... count do
JournalsForMessage.page(i).per(30).each do |message|
if !message.m_parent_id.nil? and message.parent.nil?
message.destroy
end
end
end
end
end
def down
end
end