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

try {
    $pdo = db();
    // Add is_superadmin column to users table
    $sql = "ALTER TABLE `users` ADD `is_superadmin` TINYINT(1) NOT NULL DEFAULT 0;";
    $pdo->exec($sql);
    echo "Migration 004 successful: Added 'is_superadmin' to 'users' table.\n";
} catch (PDOException $e) {
    // Check if column already exists
    if (strpos($e->getMessage(), 'Duplicate column name') !== false) {
        echo "Migration 004 warning: Column 'is_superadmin' already exists in 'users' table.\n";
    } else {
        die("Migration 004 failed: " . $e->getMessage() . "\n");
    }
}

