<?php
require 'config.php';
$conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);

$updates = [
    "ALTER TABLE submissions ADD COLUMN edit_count int DEFAULT 0",
    "ALTER TABLE submissions ADD COLUMN last_token_cost int DEFAULT 0",
];

foreach ($updates as $sql) {
    echo "Running: $sql\n";
    try {
        if ($conn->query($sql) === TRUE) {
            echo "Success\n";
        } else {
            echo "Error: " . $conn->error . "\n";
        }
    } catch (Exception $e) {
        echo "Exception: " . $e->getMessage() . "\n";
    }
}
?>
