-- Script de diagnostic pour voir l'état actuel de la base de données
-- À exécuter dans l'éditeur SQL de Supabase

-- Vérifier si les types existent
SELECT 
  typname as type_name,
  typtype as type_type
FROM pg_type 
WHERE typname IN ('email_status', 'email_type');

-- Vérifier si la table email_logs existe
SELECT 
  table_name,
  table_type
FROM information_schema.tables 
WHERE table_schema = 'public' 
  AND table_name = 'email_logs';

-- Si la table existe, voir sa structure
SELECT 
  column_name,
  data_type,
  is_nullable,
  column_default
FROM information_schema.columns 
WHERE table_schema = 'public' 
  AND table_name = 'email_logs'
ORDER BY ordinal_position;

-- Vérifier les politiques RLS existantes
SELECT 
  policyname,
  permissive,
  roles,
  cmd,
  qual,
  with_check
FROM pg_policies 
WHERE tablename = 'email_logs';