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

42 lines
1.5 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Named, user-owned server configs ("llama.cpp DFlash spec-decode, 131k
* ctx"). The full harness args that /props cannot expose live here;
* runs link via config_id and the identity joins the session grouping
* key — same hardware + model but a different draft model or
* reasoning-budget regroups into its own session.
*/
public function up(): void
{
Schema::create('server_configs', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->string('name', 128);
$table->string('engine', 64)->default('llama.cpp');
$table->text('config_yaml')->comment('full harness args (YAML blob or argv list)');
$table->timestamps();
$table->unique(['user_id', 'name']);
});
Schema::table('benchmark_runs', function (Blueprint $table) {
$table->foreignId('config_id')->nullable()->after('gpu_source')
->constrained('server_configs')->nullOnDelete();
});
}
public function down(): void
{
Schema::table('benchmark_runs', function (Blueprint $table) {
$table->dropConstrainedForeignId('config_id');
});
Schema::dropIfExists('server_configs');
}
};