删除空的课程动态
This commit is contained in:
parent
dbbdae1be2
commit
90ee4bbe60
|
@ -1,23 +0,0 @@
|
||||||
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.is_public = 0
|
|
||||||
attachment.save
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def down
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
class UpdateAttachment < 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.is_public = 0
|
||||||
|
attachment.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,17 @@
|
||||||
|
class DeleteNullCourseActivity < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
count = CourseActivity.all.count / 30 + 2
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
CourseActivity.page(i).per(30).each do |activity|
|
||||||
|
unless activity.course_act
|
||||||
|
activity.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20151019085603) do
|
ActiveRecord::Schema.define(:version => 20151020014759) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
|
Loading…
Reference in New Issue