34878-vm/db/migrations/004_add_superadmin_role.php
Flatlogic Bot 8d771ec57c V1
2025-10-11 14:09:06 +00:00

19 lines
626 B
PHP

<?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");
}
}