-- Single global model field on user_profiles. -- Replaces per-feature model selection (tabular_model) with one authoritative model -- that drives assistant chat, tabular extraction, and title generation. ALTER TABLE public.user_profiles ADD COLUMN IF NOT EXISTS model text; -- Backfill existing rows to the current manifest default. Old tabular_model values -- (gemini-3.5-flash, gemini-3.1-pro, gemini-3-flash) are invalid after the manifest -- rename, so do not copy them; resolveModel() also self-corrects any invalid value -- at runtime. UPDATE public.user_profiles SET model = 'gemini-3-flash-agent-high' WHERE model IS NULL; ALTER TABLE public.user_profiles ALTER COLUMN model SET NOT NULL; ALTER TABLE public.user_profiles ALTER COLUMN model SET DEFAULT 'gemini-3-flash-agent-high';