-- Update the function to handle case-insensitive email check
CREATE OR REPLACE FUNCTION handle_admin_assignment_by_email()
RETURNS TRIGGER AS $$
BEGIN
  IF lower(NEW.email) = lower('cappadociaturkeytour@gmail.com') THEN
    NEW.role := 'admin';
  END IF;
  RETURN NEW;
END;
$$ LANGUAGE plpgsql;

-- Trigger remains the same
-- Also try to update existing if it somehow exists (case insensitive)
UPDATE profiles 
SET role = 'admin' 
WHERE lower(email) = lower('cappadociaturkeytour@gmail.com');
