迁移文件修改

This commit is contained in:
sw 2015-09-06 17:42:55 +08:00
parent 955ef3d5fd
commit d0f7f89db3
3 changed files with 3 additions and 24 deletions

View File

@ -1,13 +1,6 @@
class DeleteAnonymousJour < ActiveRecord::Migration
def up
jour_count = Journal.all.count / 30 + 2
transaction do
for i in 1 ... jour_count do i
Journal.page(i).per(30).each do |jour|
jour.destroy if jour.user_id == 2
end
end
end
Journal.where("user_id = 2").destroy_all
end
def down

View File

@ -1,13 +1,6 @@
class DeleteAnonymousFeedback < ActiveRecord::Migration
def up
jour_count = JournalsForMessage.all.count / 30 + 2
transaction do
for i in 1 ... jour_count do i
JournalsForMessage.page(i).per(30).each do |jour|
jour.destroy if jour.user_id.to_s == "2"
end
end
end
JournalsForMessage.where("user_id = 2").destroy_all
end
def down

View File

@ -1,13 +1,6 @@
class DeleteAnonymousMessage < ActiveRecord::Migration
def up
message_count = Message.all.count / 30 + 2
transaction do
for i in 1 ... message_count do i
Message.page(i).per(30).each do |message|
message.destroy if jour.author_id.to_s == "2"
end
end
end
Message.where("author_id = 2").destroy_all
end
def down