parent
68bb142278
commit
ccfbc1e0bd
@ -0,0 +1,18 @@
|
||||
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
|
Loading…
Reference in new issue