added gifs scan at start

This commit is contained in:
onysd 2026-08-07 11:02:05 +03:00
parent 15f2d6e925
commit 4ac94f00de
10 changed files with 224 additions and 11 deletions

View file

@ -0,0 +1,2 @@
DROP INDEX IF EXISTS public.gif_catalog_source_filename_uniq;
ALTER TABLE public.gif_catalog DROP COLUMN IF EXISTS source_filename;

View file

@ -0,0 +1,12 @@
-- Tracks which gif_catalog entries came from a filesystem seed drop
-- (data/gifs/, see files.Service.SeedGifs) vs. an admin-panel upload, so a
-- restart can tell "already imported this file" from "brand new file" without
-- re-transcoding every GIF on every startup. Empty for panel-created entries.
ALTER TABLE public.gif_catalog ADD COLUMN source_filename text DEFAULT ''::text NOT NULL;
-- Only seed-imported rows need uniqueness here: two panel uploads may
-- legitimately share nothing to compare, but two seed imports of the same
-- filename must collapse to one row on every restart.
CREATE UNIQUE INDEX gif_catalog_source_filename_uniq
ON public.gif_catalog (source_filename)
WHERE source_filename <> '';