fix for retention logic
This commit is contained in:
parent
70c0ba44f0
commit
e6bfe2d444
35 changed files with 2108 additions and 132 deletions
|
|
@ -0,0 +1,3 @@
|
|||
DROP INDEX IF EXISTS public.documents_category_created_at_idx;
|
||||
ALTER TABLE public.documents
|
||||
DROP COLUMN IF EXISTS category;
|
||||
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);
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
ALTER TABLE public.account_settings
|
||||
DROP COLUMN IF EXISTS disallow_unlimited_stargifts,
|
||||
DROP COLUMN IF EXISTS disallow_limited_stargifts,
|
||||
DROP COLUMN IF EXISTS disallow_unique_stargifts,
|
||||
DROP COLUMN IF EXISTS disallow_premium_gifts,
|
||||
DROP COLUMN IF EXISTS disallow_stargifts_from_channels;
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
-- account_settings gained global gift-reception switches (Layer 228
|
||||
-- disallowedGifts) in code (internal/domain/account.go's DisallowedGifts,
|
||||
-- read/written by internal/store/postgres/account.go's GetAccountSettings/
|
||||
-- GetAccountSettingsBatch/SaveAccountSettings) without a matching migration
|
||||
-- ever being added -- every account_settings read/write has been failing
|
||||
-- with "column does not exist" on any database that never got these columns,
|
||||
-- which breaks not just gift settings but every RPC that loads cached
|
||||
-- account settings (privacy, account TTL, contact sign-up notification,
|
||||
-- sendMessage's privacy check, etc).
|
||||
ALTER TABLE public.account_settings
|
||||
ADD COLUMN IF NOT EXISTS disallow_unlimited_stargifts boolean NOT NULL DEFAULT false,
|
||||
ADD COLUMN IF NOT EXISTS disallow_limited_stargifts boolean NOT NULL DEFAULT false,
|
||||
ADD COLUMN IF NOT EXISTS disallow_unique_stargifts boolean NOT NULL DEFAULT false,
|
||||
ADD COLUMN IF NOT EXISTS disallow_premium_gifts boolean NOT NULL DEFAULT false,
|
||||
ADD COLUMN IF NOT EXISTS disallow_stargifts_from_channels boolean NOT NULL DEFAULT false;
|
||||
Loading…
Add table
Add a link
Reference in a new issue