media assets: add status column.
This commit is contained in:
@@ -3,6 +3,13 @@ class MediaAsset < ApplicationRecord
|
|||||||
delegate :metadata, to: :media_metadata
|
delegate :metadata, to: :media_metadata
|
||||||
delegate :is_animated?, :is_animated_gif?, :is_animated_png?, :is_non_repeating_animation?, :is_greyscale?, :is_rotated?, to: :metadata
|
delegate :is_animated?, :is_animated_gif?, :is_animated_png?, :is_non_repeating_animation?, :is_greyscale?, :is_rotated?, to: :metadata
|
||||||
|
|
||||||
|
enum status: {
|
||||||
|
processing: 100,
|
||||||
|
active: 200,
|
||||||
|
deleted: 300,
|
||||||
|
expunged: 400,
|
||||||
|
}
|
||||||
|
|
||||||
def self.search(params)
|
def self.search(params)
|
||||||
q = search_attributes(params, :id, :created_at, :updated_at, :md5, :file_ext, :file_size, :image_width, :image_height)
|
q = search_attributes(params, :id, :created_at, :updated_at, :md5, :file_ext, :file_size, :image_width, :image_height)
|
||||||
q = q.apply_default_order(params)
|
q = q.apply_default_order(params)
|
||||||
|
|||||||
6
db/migrate/20210926125826_add_status_to_media_assets.rb
Normal file
6
db/migrate/20210926125826_add_status_to_media_assets.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
class AddStatusToMediaAssets < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
add_column :media_assets, :status, :integer, null: false, default: 200, if_not_exists: true
|
||||||
|
add_index :media_assets, :status, where: "status != 200"
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -2474,7 +2474,8 @@ CREATE TABLE public.media_assets (
|
|||||||
file_size integer NOT NULL,
|
file_size integer NOT NULL,
|
||||||
image_width integer NOT NULL,
|
image_width integer NOT NULL,
|
||||||
image_height integer NOT NULL,
|
image_height integer NOT NULL,
|
||||||
duration double precision
|
duration double precision,
|
||||||
|
status integer DEFAULT 200 NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -7199,6 +7200,13 @@ CREATE INDEX index_media_assets_on_image_width ON public.media_assets USING btre
|
|||||||
CREATE INDEX index_media_assets_on_md5 ON public.media_assets USING btree (md5);
|
CREATE INDEX index_media_assets_on_md5 ON public.media_assets USING btree (md5);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_media_assets_on_status; Type: INDEX; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_media_assets_on_status ON public.media_assets USING btree (status) WHERE (status <> 200);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_media_assets_on_updated_at; Type: INDEX; Schema: public; Owner: -
|
-- Name: index_media_assets_on_updated_at; Type: INDEX; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
@@ -8438,6 +8446,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
|||||||
('20210908015203'),
|
('20210908015203'),
|
||||||
('20210921164936'),
|
('20210921164936'),
|
||||||
('20210921170444'),
|
('20210921170444'),
|
||||||
('20210926123414');
|
('20210926123414'),
|
||||||
|
('20210926125826');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user