<?php

declare(strict_types=1);

use Dotenv\Dotenv;
use App\Core\Database;

require_once dirname(__DIR__) . '/vendor/autoload.php';

$basePath = dirname(__DIR__);

if (file_exists($basePath . '/.env')) {
    Dotenv::createImmutable($basePath)->safeLoad();
}

$_ENV['DB_CONNECTION'] = 'mysql';
Database::ensureSchema();

$count = Database::pdo()->query('SELECT COUNT(*) FROM app_records')->fetchColumn();

echo "Ligacao MySQL OK. Registos em app_records: {$count}\n";
