-- CRM access for intern@saventh.com (Portal + CRM login match on users.email)
-- Role: Presales (adjust in Supabase if Admin/RM/KAM is preferred)

INSERT INTO users (role, full_name, email)
SELECT ur.id, 'Intern', 'intern@saventh.com' FROM user_roles ur WHERE ur.name = 'Presales' LIMIT 1
ON CONFLICT (email) DO UPDATE SET
  full_name = EXCLUDED.full_name,
  role = (SELECT id FROM user_roles WHERE name = 'Presales' LIMIT 1);
