class AlterUserActivitiesNews < ActiveRecord::Migration
  def up
    UserActivity.all.each do |activity|
      if activity.act_type == 'News'
        if activity.act
          activity.created_at = activity.act.created_on
          activity.updated_at = activity.act.respond_to?("updated_on") ? activity.act.updated_on : activity.act.created_on
          activity.save
        else
          activity.destroy
        end
      end
    end
  end

  def down
  end
end
