作品创建时间迁移
This commit is contained in:
parent
b6ff494b56
commit
044370b958
|
@ -0,0 +1,19 @@
|
|||
class HomeworkCommonTime < ActiveRecord::Migration
|
||||
def up
|
||||
count = StudentWork.all.count / 100 + 1
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
StudentWork.page(i).per(100).each do |homework|
|
||||
old_homework = HomeworkAttach.where(:user_id => homework.user_id, :name => homework.name, :description => homework.description).first
|
||||
if old_homework
|
||||
homework.update_column('created_at', old_homework.created_at)
|
||||
end
|
||||
end
|
||||
end
|
||||
puts i.to_s
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20150604153000) do
|
||||
ActiveRecord::Schema.define(:version => 20150619060110) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
|
Loading…
Reference in New Issue