<?php

declare(strict_types=1);

require dirname(__DIR__) . '/bootstrap.php';

if (!in_array('--force', $argv, true)) {
    fwrite(STDOUT, "Use --force para aplicar o patch.\n");
    exit(1);
}

$pdo = \Core\Database::connection();
$exists = $pdo->query("SHOW COLUMNS FROM academic_infos LIKE 'study_shift'")->fetch();
if ($exists) {
    fwrite(STDOUT, "Coluna study_shift já existe.\n");
    exit(0);
}
$pdo->exec("ALTER TABLE academic_infos ADD COLUMN study_shift VARCHAR(80) NULL AFTER semester");
fwrite(STDOUT, "Patch aplicado com sucesso.\n");
