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

View File

@@ -2473,7 +2473,8 @@ CREATE TABLE public.media_assets (
file_ext character varying NOT NULL,
file_size integer NOT NULL,
image_width integer NOT NULL,
image_height integer NOT NULL
image_height integer NOT NULL,
duration double precision
);
@@ -7156,6 +7157,13 @@ CREATE INDEX index_ip_geolocations_on_updated_at ON public.ip_geolocations USING
CREATE INDEX index_media_assets_on_created_at ON public.media_assets USING btree (created_at);
--
-- Name: index_media_assets_on_duration; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_media_assets_on_duration ON public.media_assets USING btree (duration) WHERE (duration IS NOT NULL);
--
-- Name: index_media_assets_on_file_ext; Type: INDEX; Schema: public; Owner: -
--
@@ -8429,6 +8437,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20210901230931'),
('20210908015203'),
('20210921164936'),
('20210921170444');
('20210921170444'),
('20210926123414');