-- Drop existing foreign key that points to auth.users ALTER TABLE public.reviews DROP CONSTRAINT IF EXISTS reviews_user_id_fkey; -- Add new foreign key constraint pointing to profiles.user_id ALTER TABLE public.reviews ADD CONSTRAINT reviews_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.profiles(user_id) ON DELETE CASCADE;