festbench-web/database/migrations/2026_09_18_000002_create_home_snapshot.php

43 lines
1.6 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Flat, precomputed snapshot of the default home view (recent results
* across suites, newest first). Written by the scheduled
* festbench:snapshot command — the request path reads this small table
* instead of running the UNION. Only the default view is snapshotted;
* filtered/sorted drill-downs use the view or concrete tables.
*/
public function up(): void
{
Schema::create('home_snapshot', function (Blueprint $table) {
$table->id();
$table->foreignId('benchmark_run_id')->index();
$table->string('run_id', 32);
$table->timestamp('ran_at')->nullable();
$table->string('suite', 32);
$table->string('model_id')->nullable();
$table->string('model_quant', 64)->nullable();
$table->string('task', 128);
$table->string('level', 16)->nullable();
$table->boolean('ok')->nullable();
$table->double('decode')->nullable();
$table->double('user_tps')->nullable();
$table->double('ttft')->nullable();
$table->double('wall')->nullable();
$table->unsignedInteger('total')->nullable();
$table->unsignedInteger('sequence')->index()->comment('snapshot row order');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('home_snapshot');
}
};