数据库为空的迁移问题

beidou_tim
huang 9 years ago
parent c4bd78e442
commit f5a88ef6f9

@ -1,5 +1,6 @@
class UpdateOneStudentScore < ActiveRecord::Migration
def up
begin
student_work_score = StudentWorksScore.where("user_id = 11688 AND student_work_id = 34414").first
student_work_score.score = 100
student_work_score.save
@ -31,6 +32,9 @@ class UpdateOneStudentScore < ActiveRecord::Migration
end
work.save
end
rescue => e
logger.error "[Errno::ENOENT] ===> #{e}"
end
end
def down

@ -1,5 +1,6 @@
class UpdateOneStudentTeacherScore < ActiveRecord::Migration
def up
begin
work = StudentWork.find 49774
score = StudentWorksScore.new
score.score = 100
@ -10,6 +11,9 @@ class UpdateOneStudentTeacherScore < ActiveRecord::Migration
work.teacher_score = score.score
end
work.save
rescue => e
logger.error "[Errno::ENOENT] ===> #{e}"
end
end
def down

Loading…
Cancel
Save