media assets: add file_key, is_public columns.

`file_key` is a random 9-character base-62 string that will be used as
the image filename in the future.

`is_public` is whether the image can be viewed without authentication or not.

Users running downstream boorus must run `bin/rails db:migrate` and
`script/fixes/109_generate_media_asset_file_keys.rb` after this commit.
This commit is contained in:
evazion
2022-05-04 22:03:25 -05:00
parent d511a6b6cf
commit 4ba993319a
5 changed files with 56 additions and 4 deletions

View File

@@ -1102,7 +1102,9 @@ CREATE TABLE public.media_assets (
image_width integer NOT NULL,
image_height integer NOT NULL,
duration double precision,
status integer DEFAULT 200 NOT NULL
status integer DEFAULT 200 NOT NULL,
file_key character varying,
is_public boolean DEFAULT true NOT NULL
);
@@ -3805,6 +3807,13 @@ CREATE INDEX index_media_assets_on_duration ON public.media_assets USING btree (
CREATE INDEX index_media_assets_on_file_ext ON public.media_assets USING btree (file_ext);
--
-- Name: index_media_assets_on_file_key; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_media_assets_on_file_key ON public.media_assets USING btree (file_key);
--
-- Name: index_media_assets_on_file_size; Type: INDEX; Schema: public; Owner: -
--
@@ -3826,6 +3835,13 @@ CREATE INDEX index_media_assets_on_image_height ON public.media_assets USING btr
CREATE INDEX index_media_assets_on_image_width ON public.media_assets USING btree (image_width);
--
-- Name: index_media_assets_on_is_public; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_media_assets_on_is_public ON public.media_assets USING btree (is_public) WHERE (is_public = false);
--
-- Name: index_media_assets_on_md5; Type: INDEX; Schema: public; Owner: -
--
@@ -5806,6 +5822,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20220403042706'),
('20220403220558'),
('20220407203236'),
('20220410050628');
('20220410050628'),
('20220504235329');