const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database('./database/ashtransfer.db');

console.log('✓ Connected to database\n');

// Check all tables
db.all("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name", [], (err, tables) => {
  if (err) {
    console.error('Error:', err);
    return;
  }
  
  console.log('📊 ALL TABLES:', tables.map(t => t.name).join(', '));
  
  // Check CMS tables specifically
  const cmsTables = ['cms_content', 'cms_vehicles', 'cms_pricing', 'cms_airports', 'cms_settings', 'cms_images'];
  console.log('\n✅ CMS TABLES:');
  
  let completed = 0;
  cmsTables.forEach(table => {
    db.get(`SELECT COUNT(*) as count FROM ${table}`, [], (err, row) => {
      if (err) {
        console.log(`   - ${table}: ERROR - ${err.message}`);
      } else {
        console.log(`   - ${table}: ${row.count} rows`);
      }
      completed++;
      if (completed === cmsTables.length) {
        db.close();
        console.log('\n🎉 Verification complete!');
      }
    });
  });
});
