posts: store duration of animations and videos.

Start storing the duration of animations and videos in the `duration`
field on the media_assets table. This had to wait until 3d30bfd69 was
deployed, which had to wait until Postgres was upgraded in order to add
the duration column to the media_assets table without downtime.

Also add a fix script to backfill the duration on existing posts. Usage:

    TAGS=animated ./script/fixes/079_fix_duration.rb
This commit is contained in:
evazion
2021-10-06 19:59:19 -05:00
parent 2595f18b2f
commit 0731b07d27
2 changed files with 16 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ class MediaAsset < ApplicationRecord
self.file_size = media_file.file_size
self.image_width = media_file.width
self.image_height = media_file.height
self.duration = media_file.duration
self.media_metadata = MediaMetadata.new(file: media_file)
end
end