-- Migration: 00017_fix_function_search_path
-- Description: Pin search_path for functions flagged by Supabase linter (0011_function_search_path_mutable)
-- Author: Dirt
-- Date: 2025-12-21

-- Rationale:
-- Setting a fixed search_path prevents role/session-level search_path changes from altering function behavior.
-- We use "pg_catalog, public" to ensure built-in functions resolve safely while preserving existing unqualified
-- references to tables in the public schema.

ALTER FUNCTION public.update_updated_at()
  SET search_path = pg_catalog, public;

ALTER FUNCTION public.set_review_published_at()
  SET search_path = pg_catalog, public;

ALTER FUNCTION public.set_response_published_at()
  SET search_path = pg_catalog, public;

ALTER FUNCTION public.generate_review_slug()
  SET search_path = pg_catalog, public;

ALTER FUNCTION public.compute_priority_score(INTEGER)
  SET search_path = pg_catalog, public;

ALTER FUNCTION public.sync_user_priority_score()
  SET search_path = pg_catalog, public;

ALTER FUNCTION public.search_reviews(TEXT, gender, TEXT, TEXT, INTEGER, INTEGER)
  SET search_path = pg_catalog, public;

ALTER FUNCTION public.get_feed_reviews(gender, INTEGER, INTEGER)
  SET search_path = pg_catalog, public;


