Nadir/supabase/migrations/20260328000000_entry_analysis_updated_at_trigger.sql
ZTatman ecf23bad29 Address PR nitpicks: lru_cache pattern, updated_at trigger, missing imports
- Align NEW_PLAN.md db.py example to use @lru_cache(maxsize=1) for both
  get_supabase() and get_embedding_model(), matching actual implementation
- Add missing imports (datetime, HTTPException, get_supabase) to
  check_ai_limit code example in NEW_PLAN.md
- Add migration to auto-update entry_analysis.updated_at on row modification
  via a BEFORE UPDATE trigger

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 19:03:47 -04:00

13 lines
367 B
PL/PgSQL

-- Auto-update entry_analysis.updated_at whenever a row is modified.
create or replace function public.set_updated_at()
returns trigger as $$
begin
new.updated_at = now();
return new;
end;
$$ language plpgsql;
create trigger trg_entry_analysis_updated_at
before update on public.entry_analysis
for each row execute function public.set_updated_at();