73 lines
2.8 KiB
PHP
73 lines
2.8 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('logs', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->timestamps();
|
|
|
|
// vazby
|
|
$table->foreignId('round_id')
|
|
->constrained('rounds')
|
|
->cascadeOnDelete();
|
|
|
|
$table->foreignId('file_id')
|
|
->nullable()
|
|
->constrained('files')
|
|
->nullOnDelete();
|
|
|
|
// stav zpracování
|
|
$table->boolean('accepted')->default(false);
|
|
$table->boolean('processed')->default(false);
|
|
|
|
// základ z EDI hlavičky (mapování na TName, TDate, PCall, PWWLo, ...)
|
|
$table->string('tname', 100)->nullable(); // TName
|
|
$table->string('tdate', 50)->nullable(); // TDate (raw)
|
|
$table->string('pcall', 20)->nullable(); // PCall
|
|
$table->string('pwwlo', 6)->nullable(); // PWWLo
|
|
$table->string('pexch', 10)->nullable(); // PExch / exchange
|
|
$table->string('psect', 10)->nullable(); // PSect
|
|
$table->string('pband', 10)->nullable(); // PBand (band label)
|
|
$table->string('pclub', 50)->nullable(); // PClub
|
|
|
|
$table->string('country_name', 150)->nullable(); // z cty_country / RCoun
|
|
$table->string('operator_name', 100)->nullable();// RName / MOpe1
|
|
$table->string('locator', 6)->nullable(); // QTH/locator dle logu
|
|
|
|
// výkon a kategorie
|
|
$table->float('power_watt')->nullable(); // SPowe
|
|
$table->string('power_category', 3)->nullable(); // power_category
|
|
$table->boolean('sixhr_category')->nullable(); // sixhr_category (Y/N => bool)
|
|
|
|
// součty z logu
|
|
$table->integer('claimed_qso_count')->nullable(); // CQSOP / qso_count
|
|
$table->integer('claimed_score')->nullable(); // CToSc
|
|
$table->string('claimed_wwl', 50)->nullable(); // CWWLs
|
|
$table->string('claimed_dxcc', 50)->nullable(); // CDXCs
|
|
|
|
// metadata / poznámky
|
|
$table->string('ip_address', 45)->nullable();
|
|
$table->string('remarks', 500)->nullable();
|
|
$table->string('remarks_eval', 500)->nullable();
|
|
|
|
// raw hlavička pro audit/debug (volitelné, ale praktické)
|
|
$table->longText('raw_header')->nullable();
|
|
|
|
// indexy pro typické filtry
|
|
$table->index(['round_id', 'pcall']);
|
|
$table->index(['round_id', 'processed']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('logs');
|
|
}
|
|
};
|