JezK
Edit File: scratch_db_update_role_migration.php
<?php require_once __DIR__ . '/config/config.php'; require_once __DIR__ . '/config/db.php'; $pdo = db(); try { $pdo->beginTransaction(); // 1. Update any users with role_id 3 (Receptionist) to role_id 2 (Operator) $stmt = $pdo->exec("UPDATE users SET role_id = 2 WHERE role_id = 3"); echo "Updated $stmt users to Operator role.\n"; // 2. Delete the Receptionist role $stmt2 = $pdo->exec("DELETE FROM roles WHERE id = 3"); echo "Deleted Receptionist role. Rows affected: $stmt2\n"; $pdo->commit(); echo "Role migration successful.\n"; } catch (PDOException $e) { $pdo->rollBack(); echo "Migration failed: " . $e->getMessage() . "\n"; }