迁移文件

dev_haigong
cxt 6 years ago
parent e46a10749b
commit cfcfc9c580

@ -0,0 +1,14 @@
class MigrateHomeworkCommonEndTimes < ActiveRecord::Migration
def up
homework_commons = HomeworkCommon.where("id < 21549")
homework_commons.find_each do |homework|
sql = "update homework_commons set end_time = (select max(end_time) from
homework_seconds where id = #{homework.id}) where id = #{homework.id}"
ActiveRecord::Base.connection.execute(sql)
end
end
def down
end
end
Loading…
Cancel
Save