feat(compat): sweep of components against the real core with strict diagnostics
This commit is contained in:
Executable
+50
@@ -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; }
|
||||
Reference in New Issue
Block a user