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…
Reference in new issue