<?php

require_once __DIR__ . '/../vendor/autoload.php';

use App\Config\Database;

$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/../');
$dotenv->load();

try {
    $conn = Database::getInstance()->getConnection();

    $sql = "CREATE TABLE IF NOT EXISTS settings (
        `key` VARCHAR(255) PRIMARY KEY,
        `value` TEXT
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;";

    $conn->exec($sql);
    echo "Tabela 'settings' criada com sucesso!" . PHP_EOL;

} catch (PDOException $e) {
    echo "Erro ao criar tabela: " . $e->getMessage() . PHP_EOL;
}
