Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop
commit
53bf69e4b4
@ -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
|
@ -0,0 +1,13 @@
|
||||
class MigrateHomeworkCommonEndTime2 < ActiveRecord::Migration
|
||||
def up
|
||||
homework_commons = HomeworkCommon.where("id >= 21549")
|
||||
homework_commons.each do |homework|
|
||||
if homework.publish_time.nil?
|
||||
homework.update_column('end_time', nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
Loading…
Reference in new issue