const { createClient } = require('@supabase/supabase-js');
require('dotenv').config();
const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_SERVICE_KEY);

async function checkSchema() {
  // Test by trying to select all columns we use
  const { data, error } = await supabase
    .from('app_users')
    .select('id, gooddollar_address, gooddollar_verified, linkedin_url, linkedin_verified, upwork_url, upwork_verified, fiverr_url, fiverr_verified, id_photo, cv_uploaded, cv_file_path, identity_tier, trust_score')
    .limit(1);
  
  if (error) {
    console.log('❌ MISSING COLUMNS:', error.message);
  } else {
    console.log('✅ All app_users columns exist');
  }
  
  // Check tasks table
  const { data: t, error: te } = await supabase
    .from('tasks')
    .select('id, title, category, budget, max_workers, status, requester_id, expires_at')
    .limit(1);
  
  if (te) {
    console.log('❌ Tasks table issue:', te.message);
  } else {
    console.log('✅ Tasks table OK');
  }
}
checkSchema();
