|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
class AddTotalDurationToWatchCourseDuration < ActiveRecord::Migration[5.2]
|
|
|
|
|
def change
|
|
|
|
|
add_column :watch_course_videos, :total_duration, :float, default: 0
|
|
|
|
|
#add_column :watch_course_videos, :total_duration, :float, default: 0
|
|
|
|
|
WatchVideoHistory.where("created_at < '2020-03-14 00:00:00'").each do |d|
|
|
|
|
|
d.watch_course_video.increment!(:total_duration, d.total_duration) if d.watch_course_video.present?
|
|
|
|
|
end
|
|
|
|
|