fix for retention logic
This commit is contained in:
parent
70c0ba44f0
commit
e6bfe2d444
35 changed files with 2108 additions and 132 deletions
18
deploy/migrations/20260902000001_documents_category.up.sql
Normal file
18
deploy/migrations/20260902000001_documents_category.up.sql
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
-- Adds a per-document media category column so the storage retention sweep
|
||||
-- can use a different retention age per category (Photo/Video/RoundVideo/
|
||||
-- Gif/Music/Voice/File/Avatar -- see TELESRV_STORAGE_RETENTION_MAX_AGE_*)
|
||||
-- instead of one shared age for every document regardless of kind.
|
||||
--
|
||||
-- The value mirrors domain.MediaCategory (int16): 0 = None/unclassified
|
||||
-- (stickers and anything else classifyDocumentCategory doesn't tag -- these
|
||||
-- always fall back to the shared global age, there is no per-category
|
||||
-- override for this bucket), 2 = Video, 3 = Gif, 4 = File, 5 = Music,
|
||||
-- 6 = Voice, 7 = RoundVideo. Deliberately NOT backfilled for existing rows:
|
||||
-- they stay at the default 0 (global age) until they are next
|
||||
-- created/edited, which is an acceptable one-time transitional behavior --
|
||||
-- backfilling would require re-deriving the category from each document's
|
||||
-- already-stored attributes for potentially every row in the table.
|
||||
ALTER TABLE public.documents
|
||||
ADD COLUMN category smallint NOT NULL DEFAULT 0;
|
||||
|
||||
CREATE INDEX documents_category_created_at_idx ON public.documents (category, created_at);
|
||||
Loading…
Add table
Add a link
Reference in a new issue