<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);

require_once __DIR__ . '/../config.php';

try {
    $sqls = [
        "ALTER TABLE users ADD COLUMN full_name VARCHAR(100) NULL AFTER password",
        "ALTER TABLE users ADD COLUMN email VARCHAR(100) NULL AFTER full_name",
        "ALTER TABLE users ADD COLUMN phone VARCHAR(20) NULL AFTER email",
        "ALTER TABLE users ADD COLUMN profile_image VARCHAR(255) NULL AFTER phone",

        "ALTER TABLE admins ADD COLUMN full_name VARCHAR(100) NULL AFTER password",
        "ALTER TABLE admins ADD COLUMN email VARCHAR(100) NULL AFTER full_name",
        "ALTER TABLE admins ADD COLUMN phone VARCHAR(20) NULL AFTER email",
        "ALTER TABLE admins ADD COLUMN profile_image VARCHAR(255) NULL AFTER phone"
    ];

    foreach ($sqls as $sql) {
        try {
            $pdo->exec($sql);
            echo "Executed: $sql\n";
        } catch (PDOException $e) {
            echo "Error executing $sql: " . $e->getMessage() . "\n";
        }
    }
    echo "Database updated successfully.";

} catch (PDOException $e) {
    echo "General Error: " . $e->getMessage();
}
