parent
9cf1278e99
commit
0b565b1be0
@ -0,0 +1,23 @@
|
|||||||
|
class UpdateAttachments < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
count = Attachment.all.count / 30 + 2
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
Attachment.page(i).per(30).each do |attachment|
|
||||||
|
if attachment.container_type == 'Course'
|
||||||
|
course = attachment.course
|
||||||
|
if course
|
||||||
|
if course.is_public == 0 && attachment.attachtype == 1
|
||||||
|
attachment.is_public = 0
|
||||||
|
attachment.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue