<?php
require_once 'config/database.php';

echo "Checking for teacher-related tables...\n";

$tablesToCheck = [
    'teachers',
    'teacher_routines',
    'teacher_attendance',
    'class_subjects'
];

foreach ($tablesToCheck as $table) {
    try {
        $stmt = $pdo->query("SHOW TABLES LIKE '$table'");
        if ($stmt->rowCount() > 0) {
            echo "✓ $table table exists\n";
        } else {
            echo "✗ $table table does not exist\n";
        }
    } catch (Exception $e) {
        echo "Error checking $table: " . $e->getMessage() . "\n";
    }
}

echo "\nChecking if class_subjects table has teacher_id column...\n";
try {
    $stmt = $pdo->query("DESCRIBE class_subjects");
    $columns = [];
    while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
        $columns[] = $row[0];
    }
    
    if (in_array('teacher_id', $columns)) {
        echo "✓ class_subjects table has teacher_id column\n";
    } else {
        echo "✗ class_subjects table does not have teacher_id column\n";
    }
} catch (Exception $e) {
    echo "Error checking class_subjects table: " . $e->getMessage() . "\n";
}
?>