feat(compat): sweep of components against the real core with strict diagnostics

This commit is contained in:
kj
2026-10-05 17:36:08 -03:00
parent 1127272330
commit 0b98b7a26b
19 changed files with 740 additions and 1 deletions
+50
View File
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Smoke commands:migration sobre sqlite (flujo CLI real del proyecto).
# Recibe BASE, PROJ, PKG, LOG, RESULTS.
set -u
res() { echo "$PKG:$1|$2" >> "$RESULTS"; }
mkdir -p "$PROJ/migrations"
cat > "$PROJ/migrations/2026_01_01_000000_compat_demo.php" <<'PHP'
<?php
use Libs\Migration;
return new class () extends Migration {
public function up(): void
{
$this->create('compat_table', [
'id INTEGER PRIMARY KEY AUTOINCREMENT',
$this->string('name'),
]);
}
public function down(): void
{
$this->dropTable('compat_table');
}
};
PHP
if ! (cd "$PROJ" && php duckbrain migration migrate >"$PROJ/../migrate.out" 2>&1); then
echo " migrate fallo:" >&2
sed 's/^/ /' "$PROJ/../migrate.out" >&2
res migration fail
exit 0
fi
PROJ_PATH="$PROJ" php -r '
$proj = getenv("PROJ_PATH");
$db = new PDO("sqlite:$proj/app.sqlite");
$table = (bool) $db->query("SELECT name FROM sqlite_master WHERE type=" . chr(39) . "table" . chr(39) . " AND name=" . chr(39) . "compat_table" . chr(39))->fetchColumn();
$ledger = glob("$proj/migrations/migrations-*.sqlite")[0] ?? null;
$done = 0;
if ($ledger !== null) {
$l = new PDO("sqlite:" . $ledger);
$done = (int) $l->query("SELECT COUNT(*) FROM migrations")->fetchColumn();
}
exit($table && $done === 1 ? 0 : 1);' \
&& res migration ok \
|| { echo " compat_table o registro de migracion ausentes" >&2; res migration fail; }