-- 🔍 Trouver l'abonnement pour l'user_id : 3907a1cc-87db-4d5b-bbe7-d56f96cdb120

SELECT 
  us.stripe_subscription_id,
  us.stripe_customer_id,
  u.email,
  us.status,
  us.plan_id,
  us.current_period_start,
  us.current_period_end,
  EXTRACT(DAY FROM us.current_period_end - NOW()) as jours_restants,
  us.created_at as date_creation
FROM user_subscriptions us
LEFT JOIN auth.users u ON u.id = us.user_id
WHERE us.user_id = '3907a1cc-87db-4d5b-bbe7-d56f96cdb120'
ORDER BY us.created_at DESC;

