media assets: add duration column.

Add a column for tracking the duration (length) of videos and
animations. The duration will be null for static images.
This commit is contained in:
evazion
2021-09-26 07:45:29 -05:00
parent ab3f35580f
commit 3d30bfd69d
2 changed files with 17 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
class AddDurationToMediaAssets < ActiveRecord::Migration[6.1]
def change
add_column :media_assets, :duration, :float, null: true, default: nil, if_not_exists: true
add_index :media_assets, :duration, where: "duration IS NOT NULL"
end
end