<?php
require_once 'api/db.php';

try {
    $pdo->exec("CREATE TABLE IF NOT EXISTS `print_queue` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `sale_id` int(11) NOT NULL,
        `user_id` int(11) NOT NULL,
        `terminal_name` varchar(50) DEFAULT NULL,
        `status` enum('Pending','Printed') NOT NULL DEFAULT 'Pending',
        `created_at` timestamp DEFAULT current_timestamp(),
        PRIMARY KEY (`id`),
        KEY `user_id` (`user_id`),
        KEY `status` (`status`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
    echo "Database updated successfully: Created print_queue table.\n";
} catch (PDOException $e) {
    echo "Error updating database: " . $e->getMessage() . "\n";
}
?>
