-- Add foreign key relationship from cars.owner_id to profiles.id
-- This enables Supabase to join cars with profiles

ALTER TABLE public.cars
DROP CONSTRAINT IF EXISTS cars_owner_id_fkey;

ALTER TABLE public.cars
ADD CONSTRAINT cars_owner_id_profiles_fkey
FOREIGN KEY (owner_id) REFERENCES public.profiles(id) ON DELETE CASCADE;
