-- remove_triggers_for_profile_embeddings.sql
-- Run this in your Supabase SQL Editor to completely disable the triggers
-- causing the "embedding generation failed" error.

-- 1. Drop the trigger that refreshes recommendations
DROP TRIGGER IF EXISTS on_profile_embedding_change ON public.profile_embeddings;

-- 2. Drop the redundant webhook trigger
DROP TRIGGER IF EXISTS on_profile_embedding_upsert ON public.profile_embeddings;

-- 3. Drop the function that refreshes recommendations
DROP FUNCTION IF EXISTS public.trg_refresh_recommendations_for_user CASCADE;

-- 4. Drop the function for the webhook trigger
DROP FUNCTION IF EXISTS public.trg_on_profile_embedding_update CASCADE;

-- Now the Python upsert:
-- client.table("profile_embeddings").upsert(payload).execute()
-- will run purely as a database insert without any hidden functions interrupting it.
