socialforge/db/migrate/20160830090214_delete_null_...

18 lines
318 B
Ruby
Raw Normal View History

2016-08-30 17:11:22 +08:00
class DeleteNullAtMessages < ActiveRecord::Migration
def up
count = AtMessage.all.count / 30 + 2
transaction do
for i in 1 ... count do i
AtMessage.page(i).per(30).each do |am|
if am.at_message.nil?
am.destroy
end
end
end
end
end
def down
end
end