exec($sql); echo "Table 'roles' renamed to 'functions' successfully." . PHP_EOL; $sql = "RENAME TABLE `user_roles` TO `user_functions`;"; $pdo->exec($sql); echo "Table 'user_roles' renamed to 'user_functions' successfully." . PHP_EOL; $sql = "ALTER TABLE `user_functions` CHANGE `role_id` `function_id` INT(11) UNSIGNED NOT NULL;"; $pdo->exec($sql); echo "Column 'role_id' renamed to 'function_id' in 'user_functions' table successfully." . PHP_EOL; } catch (PDOException $e) { echo "Error renaming tables or columns: " . $e->getMessage() . PHP_EOL; exit(1); }