You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trustieforge/db/migrate/20151124032319_delete_usele...

19 lines
611 B

class DeleteUselessOrgActivities < ActiveRecord::Migration
def up
OrgActivity.all.each do |act|
if act.container_type == 'Course'
if CourseActivity.where("course_act_type=? and course_act_id =? and course_id =?", act.org_act_type, act.org_act_id, act.container_id).count == 0
puts "course"
end
else
if act.container_type == 'Project' and ForgeActivity.where("forge_act_type=? and forge_act_id =? and project_id =?", act.org_act_type, act.org_act_id, act.container_id).count == 0
act.destroy
end
end
end
end
def down
end
end