<?php
require __DIR__ . '/../bootstrap.php';
use Gestoreasy\Core\Tenant\ConnectionManager;

$tenant = $argv[1] ?? 'default';
$table = $argv[2] ?? null;
if (!$table) { fwrite(STDERR, "Usage: php scripts/db_describe.php <tenant> <table>\n"); exit(1); }
$pdo = ConnectionManager::forTenant($tenant);
$stmt = $pdo->query('DESCRIBE ' . $table);
$rows = $stmt->fetchAll();
echo json_encode($rows, JSON_UNESCAPED_UNICODE) . "\n";