Initial commit

This commit is contained in:
Zdeněk Burda
2026-01-09 21:26:40 +01:00
parent e83aec6dca
commit 41e3ce6f25
404 changed files with 61250 additions and 28 deletions

View File

@@ -0,0 +1,50 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->boolean('is_admin')->default(false);
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration');
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};

View File

@@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->text('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable()->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('edi_bands', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('value');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('edi_bands');
}
};

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('bands', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name');
$table->integer('order')->default(0);
$table->bigInteger('edi_band_begin');
$table->bigInteger('edi_band_end');
$table->boolean('has_power_category')->default(false);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('bands');
}
};

View File

@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('categories', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name');
$table->integer('order')->default(10);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('categories');
}
};

View File

@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('power_categories', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name')->unique();
$table->integer('order')->default(10);
$table->bigInteger('power_level')->default(0);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('power_categories');
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('bands_edi_bands', function (Blueprint $table) {
$table->timestamps();
$table->unsignedBigInteger('band_id');
$table->unsignedBigInteger('edi_band_id');
$table->foreign('band_id')->references('id')->on('bands')->cascadeOnDelete();
$table->foreign('edi_band_id')->references('id')->on('edi_bands')->cascadeOnDelete();
$table->primary(['band_id', 'edi_band_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('bands_edi_bands');
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('edi_categories', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('value');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('edi_categories');
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('categories_edi_categories', function (Blueprint $table) {
$table->timestamps();
$table->unsignedBigInteger('category_id');
$table->unsignedBigInteger('edi_category_id');
$table->foreign('category_id')->references('id')->on('categories')->cascadeOnDelete();
$table->foreign('edi_category_id')->references('id')->on('edi_categories')->cascadeOnDelete();
$table->primary(['category_id', 'edi_category_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('categories_edi_categories');
}
};

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cty', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('country_name', 150);
$table->integer('cq_zone');
$table->integer('itu_zone');
$table->string('continent', 2);
$table->decimal('latitude', 10, 2);
$table->decimal('longitude', 10, 2);
$table->decimal('time_offset', 10, 2);
$table->string('prefix', 25)->unique();
$table->boolean('precise')->default(false);
$table->string('source', 25);
$table->index('continent');
$table->index('cq_zone');
$table->index('itu_zone');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cty');
}
};

View File

@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('countries_wwl', function (Blueprint $table) {
$table->timestamps();
$table->string('country_name', 150);
$table->string('wwl', 4);
$table->primary(['country_name','wwl']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('countries_wwl');
}
};

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('contests', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->json('name');
$table->json('description')->nullable();
$table->string('url')->nullable();
$table->string('evaluator')->default('Český radioklub')->nullable();
$table->string('email')->default('vkvzavody@crk.cz')->nullable();
$table->string('email2')->nullable();
$table->boolean('is_mcr')->default(false)->index();
$table->boolean('is_active')->default(false)->index();
$table->boolean('is_test')->default(false)->index();
$table->boolean('is_sixhr')->default(false)->index();
$table->time('start_time')->default('14:00:00');
$table->integer('duration')->default(24);
$table->integer('logs_deadline_days')->default(3);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('contests');
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('contests_power_categories', function (Blueprint $table) {
$table->timestamps();
$table->unsignedBigInteger('contest_id');
$table->unsignedBigInteger('power_category_id');
$table->foreign('contest_id')->references('id')->on('contests')->cascadeOnDelete();
$table->foreign('power_category_id')->references('id')->on('power_categories')->cascadeOnDelete();
$table->primary(['contest_id', 'power_category_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('contests_power_categories');
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('contests_categories', function (Blueprint $table) {
$table->timestamps();
$table->unsignedBigInteger('contest_id');
$table->unsignedBigInteger('category_id');
$table->foreign('contest_id')->references('id')->on('contests')->cascadeOnDelete();
$table->foreign('category_id')->references('id')->on('categories')->cascadeOnDelete();
$table->primary(['contest_id', 'category_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('contests_categories');
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('contests_bands', function (Blueprint $table) {
$table->timestamps();
$table->unsignedBigInteger('contest_id');
$table->unsignedBigInteger('band_id');
$table->foreign('contest_id')->references('id')->on('contests')->cascadeOnDelete();
$table->foreign('band_id')->references('id')->on('bands')->cascadeOnDelete();
$table->primary(['contest_id', 'band_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('contests_bands');
}
};

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('rounds', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->unsignedBigInteger('contest_id');
$table->json('name');
$table->json('description')->nullable();
$table->dateTime('start_time');
$table->dateTime('end_time');
$table->dateTime('logs_deadline');
$table->boolean('is_mcr')->default(false)->index();
$table->boolean('is_active')->default(false)->index();
$table->boolean('is_test')->default(false)->index();
$table->boolean('is_sixhr')->default(false)->index();
$table->datetime('first_check')->nullable();
$table->datetime('second_check')->nullable();
$table->datetime('unique_qso_check')->nullable();
$table->datetime('third_check')->nullable();
$table->datetime('fourth_check')->nullable();
$table->datetime('prelimitary_results')->nullable();
$table->foreign('contest_id')->references('id')->on('contests')->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('rounds');
}
};

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('contests_parameters', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->unsignedBigInteger('contest_id');
$table->enum('log_type', ['STANDARD', 'CHECK']);
$table->boolean('ignore_slash_part')->default(true);
$table->boolean('ignore_third_part')->default(true);
$table->boolean('letters_in_rst')->default(true);
$table->boolean('discard_qso_rec_diff_call')->default(true);
$table->boolean('discard_qso_sent_diff_call')->default(false);
$table->boolean('discard_qso_rec_diff_rst')->default(true);
$table->boolean('discard_qso_sent_diff_rst')->default(false);
$table->boolean('discard_qso_rec_diff_code')->default(true);
$table->boolean('discard_qso_sent_diff_code')->default(false);
$table->boolean('unique_qso')->default(true);
$table->integer('time_tolerance')->default(600);
$table->foreign('contest_id')
->references('id')->on('contests')
->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('contests_parameters');
}
};

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('rounds_parameters', function (Blueprint $table) {
$table->id(); // přidat
$table->timestamps();
$table->unsignedBigInteger('round_id');
$table->enum('log_type', ['STANDARD', 'CHECK']);
$table->boolean('ignore_slash_part')->default(true);
$table->boolean('ignore_third_part')->default(true);
$table->boolean('letters_in_rst')->default(true);
$table->boolean('discard_qso_rec_diff_call')->default(true);
$table->boolean('discard_qso_sent_diff_call')->default(false);
$table->boolean('discard_qso_rec_diff_rst')->default(true);
$table->boolean('discard_qso_sent_diff_rst')->default(false);
$table->boolean('discard_qso_rec_diff_code')->default(true);
$table->boolean('discard_qso_sent_diff_code')->default(false);
$table->boolean('unique_qso')->default(true);
$table->integer('time_tolerance')->default(600);
$table->foreign('round_id')->references('id')->on('rounds')->cascadeOnDelete();
// pokud chceš jednu sadu paramů na (round_id, log_type):
// $table->unique(['round_id', 'log_type']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('rounds_parameters');
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('rounds_bands', function (Blueprint $table) {
$table->timestamps();
$table->unsignedBigInteger('round_id');
$table->unsignedBigInteger('band_id');
$table->foreign('round_id')->references('id')->on('rounds')->cascadeOnDelete();
$table->foreign('band_id')->references('id')->on('bands')->cascadeOnDelete();
$table->primary(['round_id', 'band_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('rounds_bands');
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('rounds_categories', function (Blueprint $table) {
$table->timestamps();
$table->unsignedBigInteger('round_id');
$table->unsignedBigInteger('category_id');
$table->foreign('round_id')->references('id')->on('rounds')->cascadeOnDelete();
$table->foreign('category_id')->references('id')->on('categories')->cascadeOnDelete();
$table->primary(['round_id', 'category_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('rounds_categories');
}
};

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('rounds_power_categories', function (Blueprint $table) {
$table->timestamps();
$table->unsignedBigInteger('round_id');
$table->unsignedBigInteger('power_category_id');
$table->foreign('round_id')->references('id')->on('rounds')->cascadeOnDelete();
$table->foreign('power_category_id')->references('id')->on('power_categories')->cascadeOnDelete();
$table->primary(['round_id', 'power_category_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('rounds_power_categories');
}
};

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('files', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('path');
$table->string('filename');
$table->string('mimetype');
$table->unsignedBigInteger('filesize');
$table->string('hash')->unique();
$table->string('uploaded_by')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('files');
}
};

View File

@@ -0,0 +1,72 @@
<?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');
}
};

View File

@@ -0,0 +1,59 @@
<?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('log_qsos', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->foreignId('log_id')
->constrained('logs')
->cascadeOnDelete();
// pořadí v logu
$table->integer('qso_index')->nullable();
// základní pole z QSO řádku
$table->dateTime('time_on')->nullable(); // kombinace data + času
$table->string('band', 10)->nullable(); // odvozeno z frekvence / PBand
$table->integer('freq_khz')->nullable(); // QSO frekvence v kHz
$table->string('mode', 5)->nullable(); // CW/SSB/etc.
// naše strana
$table->string('my_call', 20)->nullable();
$table->string('my_rst', 10)->nullable();
$table->string('my_serial', 10)->nullable();
$table->string('my_locator', 6)->nullable();
// protistanice
$table->string('dx_call', 20)->nullable();
$table->string('dx_rst', 10)->nullable();
$table->string('dx_serial', 10)->nullable();
$table->string('dx_locator', 6)->nullable();
// vyhodnocení
$table->integer('points')->nullable();
$table->string('wwl', 6)->nullable(); // odvozený WWL
$table->string('dxcc', 10)->nullable();
$table->boolean('is_duplicate')->default(false);
$table->boolean('is_valid')->default(true);
// raw QSO řádek tak, jak byl v EDI
$table->string('raw_line', 500)->nullable();
$table->index(['log_id', 'band']);
$table->index(['log_id', 'dx_call']);
});
}
public function down(): void
{
Schema::dropIfExists('log_qsos');
}
};

View File

@@ -0,0 +1,72 @@
<?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('evaluation_rule_sets', function (Blueprint $table) {
$table->id();
$table->timestamps();
// identifikace rulesetu
$table->string('name', 100);
$table->string('code', 50)->unique(); // např. "IARU_VHF_2025"
$table->text('description')->nullable();
// základ scoringu
$table->enum('scoring_mode', ['DISTANCE', 'FIXED_POINTS'])
->default('DISTANCE');
// FIXED_POINTS: body za QSO
$table->integer('points_per_qso')->default(1);
// DISTANCE: body za km
$table->float('points_per_km')->default(1.0);
// multiplikátory
$table->boolean('use_multipliers')->default(true);
$table->enum('multiplier_type', ['NONE', 'WWL', 'DXCC', 'SECTION', 'COUNTRY'])
->default('WWL');
// politika duplicit
$table->enum('dup_qso_policy', [
'COUNT_ONCE', // další QSO = 0 bodů
'ZERO_POINTS', // explicitně 0 bodů, bez penalizace
'PENALTY', // 0 bodů + penalizace
])->default('ZERO_POINTS');
// NIL / not-in-log
$table->enum('nil_qso_policy', [
'ZERO_POINTS', // smazat body za QSO
'PENALTY', // smazat + penalizace
])->default('PENALTY');
// busted call / exchange
$table->enum('busted_call_policy', [
'ZERO_POINTS',
'PENALTY',
])->default('PENALTY');
$table->enum('busted_exchange_policy', [
'ZERO_POINTS',
'PENALTY',
])->default('ZERO_POINTS');
// časová tolerance a pravidla duplicit jsou součástí rulesetu
$table->integer('time_tolerance_sec')->nullable();
$table->boolean('require_unique_qso')->default(true);
// obecné doplňkové nastavení (např. per-band multipliers, speciální bonusy)
$table->json('options')->nullable();
});
}
public function down(): void
{
Schema::dropIfExists('evaluation_rule_sets');
}
};

View File

@@ -0,0 +1,35 @@
<?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('evaluation_runs', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->foreignId('round_id')
->constrained('rounds')
->cascadeOnDelete();
$table->foreignId('rule_set_id')
->nullable()
->constrained('evaluation_rule_sets')
->nullOnDelete();
$table->string('name', 100)->nullable();
$table->string('rules_version', 100)->nullable();
$table->boolean('is_official')->default(false);
$table->text('notes')->nullable();
});
}
public function down(): void
{
Schema::dropIfExists('evaluation_runs');
}
};

View File

@@ -0,0 +1,56 @@
<?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('log_results', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->foreignId('evaluation_run_id')
->constrained('evaluation_runs')
->cascadeOnDelete();
$table->foreignId('log_id')
->constrained('logs')
->cascadeOnDelete();
// kategorizační kontext (tak jak byl pro daný běh určen)
$table->foreignId('band_id')->nullable()->constrained('bands');
$table->foreignId('category_id')->nullable()->constrained('categories');
$table->foreignId('power_category_id')->nullable()->constrained('power_categories');
// claim vs. official
$table->integer('claimed_qso_count')->nullable();
$table->integer('claimed_score')->nullable();
$table->integer('valid_qso_count')->default(0);
$table->integer('dupe_qso_count')->default(0);
$table->integer('busted_qso_count')->default(0); // chybný call/rst/locator
$table->integer('other_error_qso_count')->default(0);
$table->integer('official_score')->default(0);
$table->integer('penalty_score')->default(0);
// pořadí v závodě / kategorii
$table->integer('rank_overall')->nullable();
$table->integer('rank_in_category')->nullable();
// stav logu v evaluaci
$table->string('status', 20)->default('OK'); // např. OK / CHECK / DQ / MISSING
$table->text('status_reason')->nullable();
$table->unique(['evaluation_run_id', 'log_id']);
});
}
public function down(): void
{
Schema::dropIfExists('log_results');
}
};

View File

@@ -0,0 +1,54 @@
<?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('qso_results', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->foreignId('evaluation_run_id')
->constrained('evaluation_runs')
->cascadeOnDelete();
$table->foreignId('log_qso_id')
->constrained('log_qsos')
->cascadeOnDelete();
// výsledek QSO
$table->boolean('is_valid')->default(true);
$table->boolean('is_duplicate')->default(false);
$table->boolean('is_nil')->default(false); // neodpovídající QSO v druhém logu
$table->boolean('is_busted_call')->default(false);
$table->boolean('is_busted_rst')->default(false);
$table->boolean('is_busted_exchange')->default(false);
$table->boolean('is_time_out_of_window')->default(false);
$table->integer('points')->default(0);
$table->double('distance_km')->nullable();
// multipliers
$table->string('wwl', 6)->nullable();
$table->string('dxcc', 10)->nullable();
// volitelný link na odpovídající QSO v druhém logu
$table->unsignedBigInteger('matched_qso_id')->nullable();
// obecná chybová kategorizace
$table->string('error_code', 50)->nullable(); // např. "BUSTED_CALL", "DUP", ...
$table->text('error_detail')->nullable();
$table->index(['evaluation_run_id', 'log_qso_id']);
});
}
public function down(): void
{
Schema::dropIfExists('qso_results');
}
};

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->text('two_factor_secret')
->after('password')
->nullable();
$table->text('two_factor_recovery_codes')
->after('two_factor_secret')
->nullable();
$table->timestamp('two_factor_confirmed_at')
->after('two_factor_recovery_codes')
->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn([
'two_factor_secret',
'two_factor_recovery_codes',
'two_factor_confirmed_at',
]);
});
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('rounds_parameters', function (Blueprint $table) {
$table->unique(['round_id', 'log_type'], 'rounds_parameters_round_logtype_unique');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('rounds_parameters', function (Blueprint $table) {
$table->dropUnique('rounds_parameters_round_logtype_unique');
});
}
};

View File

@@ -0,0 +1,74 @@
<?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::table('logs', function (Blueprint $table) {
$table->string('padr1', 255)->nullable()->after('pclub');
$table->string('padr2', 255)->nullable()->after('padr1');
$table->string('radr1', 255)->nullable()->after('padr2');
$table->string('radr2', 255)->nullable()->after('radr1');
$table->string('rpoco', 50)->nullable()->after('radr2');
$table->string('rcity', 100)->nullable()->after('rpoco');
$table->string('rphon', 100)->nullable()->after('rcity');
$table->string('rhbbs', 150)->nullable()->after('rphon');
$table->string('mope1', 100)->nullable()->after('rhbbs');
$table->string('mope2', 100)->nullable()->after('mope1');
$table->string('stxeq', 150)->nullable()->after('mope2');
$table->string('srxeq', 150)->nullable()->after('stxeq');
$table->string('sante', 150)->nullable()->after('srxeq');
$table->string('santh', 50)->nullable()->after('sante');
$table->string('cqsos', 50)->nullable()->after('santh');
$table->string('cqsop', 50)->nullable()->after('cqsos');
$table->string('cwwls', 50)->nullable()->after('cqsop');
$table->string('cwwlb', 50)->nullable()->after('cwwls');
$table->string('cexcs', 50)->nullable()->after('cwwlb');
$table->string('cexcb', 50)->nullable()->after('cexcs');
$table->string('cdxcs', 50)->nullable()->after('cexcb');
$table->string('cdxcb', 50)->nullable()->after('cdxcs');
$table->string('ctosc', 50)->nullable()->after('cdxcb');
$table->string('codxc', 255)->nullable()->after('ctosc');
});
}
public function down(): void
{
Schema::table('logs', function (Blueprint $table) {
$table->dropColumn([
'padr1',
'padr2',
'radr1',
'radr2',
'rpoco',
'rcity',
'rphon',
'rhbbs',
'mope1',
'mope2',
'stxeq',
'srxeq',
'sante',
'santh',
'cqsos',
'cqsop',
'cwwls',
'cwwlb',
'cexcs',
'cexcb',
'cdxcs',
'cdxcb',
'ctosc',
'codxc',
]);
});
}
};

View File

@@ -0,0 +1,32 @@
<?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::table('logs', function (Blueprint $table) {
if (Schema::hasColumn('logs', 'operator_name')) {
$table->renameColumn('operator_name', 'rname');
}
if (Schema::hasColumn('logs', 'country_name')) {
$table->renameColumn('country_name', 'rcoun');
}
});
}
public function down(): void
{
Schema::table('logs', function (Blueprint $table) {
if (Schema::hasColumn('logs', 'rname')) {
$table->renameColumn('rname', 'operator_name');
}
if (Schema::hasColumn('logs', 'rcoun')) {
$table->renameColumn('rcoun', 'country_name');
}
});
}
};

View File

@@ -0,0 +1,26 @@
<?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::table('logs', function (Blueprint $table) {
if (! Schema::hasColumn('logs', 'rcall')) {
$table->string('rcall', 20)->nullable()->after('rname');
}
});
}
public function down(): void
{
Schema::table('logs', function (Blueprint $table) {
if (Schema::hasColumn('logs', 'rcall')) {
$table->dropColumn('rcall');
}
});
}
};

View File

@@ -0,0 +1,54 @@
<?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::table('log_qsos', function (Blueprint $table) {
if (Schema::hasColumn('log_qsos', 'dx_locator') && ! Schema::hasColumn('log_qsos', 'rx_wwl')) {
$table->renameColumn('dx_locator', 'rx_wwl');
} elseif (! Schema::hasColumn('log_qsos', 'rx_wwl')) {
$table->string('rx_wwl', 10)->nullable()->after('dx_call');
}
if (! Schema::hasColumn('log_qsos', 'mode_code')) {
$table->string('mode_code', 5)->nullable()->after('dx_call');
}
if (! Schema::hasColumn('log_qsos', 'rx_exchange')) {
$table->string('rx_exchange', 10)->nullable()->after('dx_serial');
}
if (! Schema::hasColumn('log_qsos', 'new_exchange')) {
$table->boolean('new_exchange')->nullable()->after('points');
}
if (! Schema::hasColumn('log_qsos', 'new_wwl')) {
$table->boolean('new_wwl')->nullable()->after('new_exchange');
}
if (! Schema::hasColumn('log_qsos', 'new_dxcc')) {
$table->boolean('new_dxcc')->nullable()->after('new_wwl');
}
if (! Schema::hasColumn('log_qsos', 'duplicate_qso')) {
$table->boolean('duplicate_qso')->nullable()->after('new_dxcc');
}
});
}
public function down(): void
{
Schema::table('log_qsos', function (Blueprint $table) {
if (Schema::hasColumn('log_qsos', 'rx_wwl') && ! Schema::hasColumn('log_qsos', 'dx_locator')) {
$table->renameColumn('rx_wwl', 'dx_locator');
}
$columns = ['mode_code', 'rx_exchange', 'new_exchange', 'new_wwl', 'new_dxcc', 'duplicate_qso'];
foreach ($columns as $col) {
if (Schema::hasColumn('log_qsos', $col)) {
$table->dropColumn($col);
}
}
});
}
};

View File

@@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('news_posts', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->json('title');
$table->string('slug')->unique();
// Markdown obsah
$table->json('content');
// Krátké shrnutí pro listing (volitelné)
$table->json('excerpt')->nullable();
// Publikační stav
$table->boolean('is_published')->default(false);
$table->timestamp('published_at')->nullable();
// Autor
$table->foreignId('author_id')
->nullable()
->constrained('users')
->nullOnDelete();
// Pro rychlé filtrování
$table->index(['is_published', 'published_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('news_posts');
}
};

View File

@@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('evaluation_runs', function (Blueprint $table) {
$table->string('status', 50)->nullable()->after('notes');
$table->string('batch_id', 100)->nullable()->after('status');
$table->string('current_step', 100)->nullable()->after('batch_id');
$table->unsignedInteger('progress_total')->nullable()->after('current_step');
$table->unsignedInteger('progress_done')->nullable()->after('progress_total');
$table->json('scope')->nullable()->after('progress_done');
$table->text('error')->nullable()->after('scope');
$table->timestamp('started_at')->nullable()->after('error');
$table->timestamp('finished_at')->nullable()->after('started_at');
$table->foreignId('created_by_user_id')
->nullable()
->after('finished_at')
->constrained('users')
->nullOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('evaluation_runs', function (Blueprint $table) {
$table->dropForeign(['created_by_user_id']);
$table->dropColumn([
'status',
'batch_id',
'current_step',
'progress_total',
'progress_done',
'scope',
'error',
'started_at',
'finished_at',
'created_by_user_id',
]);
});
}
};

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('evaluation_locks', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('key', 150)->unique();
$table->foreignId('evaluation_run_id')
->nullable()
->constrained('evaluation_runs')
->nullOnDelete();
$table->timestamp('locked_at')->nullable();
$table->timestamp('expires_at')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('evaluation_locks');
}
};

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('evaluation_run_events', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->foreignId('evaluation_run_id')
->constrained('evaluation_runs')
->cascadeOnDelete();
$table->string('level', 50);
$table->text('message');
$table->json('context')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('evaluation_run_events');
}
};

View File

@@ -0,0 +1,60 @@
<?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('qso_overrides', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->foreignId('evaluation_run_id')
->constrained('evaluation_runs')
->cascadeOnDelete();
$table->foreignId('log_qso_id')
->constrained('log_qsos')
->cascadeOnDelete();
$table->foreignId('forced_matched_log_qso_id')
->nullable()
->constrained('log_qsos')
->nullOnDelete();
$table->enum('forced_status', [
'AUTO',
'VALID',
'INVALID',
'NIL',
'DUPLICATE',
'BUSTED_CALL',
'BUSTED_EXCHANGE',
'OUT_OF_WINDOW',
])->default('AUTO');
$table->double('forced_points')->nullable();
$table->double('forced_penalty')->nullable();
$table->string('reason', 500)->nullable();
$table->json('context')->nullable();
$table->foreignId('created_by_user_id')
->nullable()
->constrained('users')
->nullOnDelete();
$table->unique(['evaluation_run_id', 'log_qso_id'], 'qso_overrides_run_qso_unique');
$table->index('evaluation_run_id', 'qso_overrides_run_idx');
$table->index('log_qso_id', 'qso_overrides_qso_idx');
$table->index('forced_matched_log_qso_id', 'qso_overrides_matched_idx');
$table->index('created_by_user_id', 'qso_overrides_user_idx');
});
}
public function down(): void
{
Schema::dropIfExists('qso_overrides');
}
};

View File

@@ -0,0 +1,62 @@
<?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('log_overrides', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->foreignId('evaluation_run_id')
->constrained('evaluation_runs')
->cascadeOnDelete();
$table->foreignId('log_id')
->constrained('logs')
->cascadeOnDelete();
$table->enum('forced_log_status', ['AUTO', 'OK', 'CHECK', 'DQ', 'IGNORED'])
->default('AUTO');
$table->foreignId('forced_band_id')
->nullable()
->constrained('bands')
->nullOnDelete();
$table->foreignId('forced_category_id')
->nullable()
->constrained('categories')
->nullOnDelete();
$table->foreignId('forced_power_category_id')
->nullable()
->constrained('power_categories')
->nullOnDelete();
$table->integer('forced_power_w')->nullable();
$table->string('reason', 500)->nullable();
$table->json('context')->nullable();
$table->foreignId('created_by_user_id')
->nullable()
->constrained('users')
->nullOnDelete();
$table->unique(['evaluation_run_id', 'log_id'], 'log_overrides_run_log_unique');
$table->index('evaluation_run_id', 'log_overrides_run_idx');
$table->index('log_id', 'log_overrides_log_idx');
$table->index('created_by_user_id', 'log_overrides_user_idx');
$table->index('forced_band_id', 'log_overrides_band_idx');
$table->index('forced_category_id', 'log_overrides_category_idx');
$table->index('forced_power_category_id', 'log_overrides_power_category_idx');
});
}
public function down(): void
{
Schema::dropIfExists('log_overrides');
}
};

View File

@@ -0,0 +1,26 @@
<?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::table('logs', function (Blueprint $table) {
$table->foreignId('power_category_id')
->nullable()
->after('power_category')
->constrained('power_categories')
->nullOnDelete();
});
}
public function down(): void
{
Schema::table('logs', function (Blueprint $table) {
$table->dropConstrainedForeignId('power_category_id');
});
}
};

View File

@@ -0,0 +1,26 @@
<?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::table('log_qsos', function (Blueprint $table) {
if (Schema::hasColumn('log_qsos', 'is_duplicate')) {
$table->dropColumn('is_duplicate');
}
});
}
public function down(): void
{
Schema::table('log_qsos', function (Blueprint $table) {
if (! Schema::hasColumn('log_qsos', 'is_duplicate')) {
$table->boolean('is_duplicate')->default(false);
}
});
}
};

View File

@@ -0,0 +1,28 @@
<?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::table('evaluation_runs', function (Blueprint $table) {
if (! Schema::hasColumn('evaluation_runs', 'result_type')) {
$table->string('result_type', 20)->nullable()->after('rules_version');
$table->index('result_type');
}
});
}
public function down(): void
{
Schema::table('evaluation_runs', function (Blueprint $table) {
if (Schema::hasColumn('evaluation_runs', 'result_type')) {
$table->dropIndex(['result_type']);
$table->dropColumn('result_type');
}
});
}
};

View File

@@ -0,0 +1,24 @@
<?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::table('log_overrides', function (Blueprint $table) {
$table->boolean('forced_sixhr_category')
->nullable()
->after('forced_power_category_id');
});
}
public function down(): void
{
Schema::table('log_overrides', function (Blueprint $table) {
$table->dropColumn('forced_sixhr_category');
});
}
};

View File

@@ -0,0 +1,24 @@
<?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::table('log_results', function (Blueprint $table) {
$table->boolean('sixhr_category')
->nullable()
->after('power_category_id');
});
}
public function down(): void
{
Schema::table('log_results', function (Blueprint $table) {
$table->dropColumn('sixhr_category');
});
}
};

View File

@@ -0,0 +1,22 @@
<?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::table('logs', function (Blueprint $table) {
$table->string('psect', 255)->nullable()->change();
});
}
public function down(): void
{
Schema::table('logs', function (Blueprint $table) {
$table->string('psect', 10)->nullable()->change();
});
}
};

View File

@@ -0,0 +1,22 @@
<?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::table('edi_categories', function (Blueprint $table) {
$table->string('regex_pattern', 255)->nullable()->after('value');
});
}
public function down(): void
{
Schema::table('edi_categories', function (Blueprint $table) {
$table->dropColumn('regex_pattern');
});
}
};

View File

@@ -0,0 +1,23 @@
<?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::table('log_results', function (Blueprint $table) {
$table->integer('rank_overall_ok')->nullable()->after('rank_overall');
$table->integer('rank_in_category_ok')->nullable()->after('rank_in_category');
});
}
public function down(): void
{
Schema::table('log_results', function (Blueprint $table) {
$table->dropColumn(['rank_overall_ok', 'rank_in_category_ok']);
});
}
};

View File

@@ -0,0 +1,22 @@
<?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::table('qso_results', function (Blueprint $table) {
$table->unique(['evaluation_run_id', 'log_qso_id'], 'qso_results_run_log_qso_unique');
});
}
public function down(): void
{
Schema::table('qso_results', function (Blueprint $table) {
$table->dropUnique('qso_results_run_log_qso_unique');
});
}
};

View File

@@ -0,0 +1,46 @@
<?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::table('evaluation_rule_sets', function (Blueprint $table) {
$table->integer('penalty_dup_points')->default(0);
$table->integer('penalty_nil_points')->default(0);
$table->integer('penalty_busted_call_points')->default(0);
$table->integer('penalty_busted_exchange_points')->default(0);
$table->enum('dupe_scope', ['BAND', 'BAND_MODE'])->default('BAND');
$table->enum('callsign_normalization', ['STRICT', 'IGNORE_SUFFIX'])->default('IGNORE_SUFFIX');
$table->enum('distance_rounding', ['FLOOR', 'ROUND', 'CEIL'])->default('FLOOR');
$table->integer('min_distance_km')->nullable();
$table->boolean('require_locators')->default(true);
$table->enum('out_of_window_policy', ['IGNORE', 'ZERO_POINTS', 'PENALTY', 'INVALID'])
->default('INVALID');
});
}
public function down(): void
{
Schema::table('evaluation_rule_sets', function (Blueprint $table) {
$table->dropColumn([
'penalty_dup_points',
'penalty_nil_points',
'penalty_busted_call_points',
'penalty_busted_exchange_points',
'dupe_scope',
'callsign_normalization',
'distance_rounding',
'min_distance_km',
'require_locators',
'out_of_window_policy',
]);
});
}
};

View File

@@ -0,0 +1,52 @@
<?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('working_qsos', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->foreignId('evaluation_run_id')
->constrained('evaluation_runs')
->cascadeOnDelete();
$table->foreignId('log_qso_id')
->constrained('log_qsos')
->cascadeOnDelete();
$table->foreignId('log_id')
->constrained('logs')
->cascadeOnDelete();
$table->dateTime('ts_utc')->nullable();
$table->string('call_norm', 32)->nullable();
$table->string('rcall_norm', 32)->nullable();
$table->string('loc_norm', 6)->nullable();
$table->string('rloc_norm', 6)->nullable();
$table->foreignId('band_id')->nullable()->constrained('bands');
$table->string('mode', 10)->nullable();
$table->string('match_key', 120)->nullable();
$table->string('dupe_key', 120)->nullable();
$table->boolean('out_of_window')->default(false);
$table->json('errors')->nullable();
$table->unique(['evaluation_run_id', 'log_qso_id']);
$table->index(['evaluation_run_id', 'log_id']);
$table->index(['evaluation_run_id', 'match_key']);
$table->index(['evaluation_run_id', 'dupe_key']);
});
}
public function down(): void
{
Schema::dropIfExists('working_qsos');
}
};

View File

@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
$driver = DB::getDriverName();
if (in_array($driver, ['mysql', 'mariadb'], true)) {
DB::statement('ALTER TABLE qso_results MODIFY distance_km DOUBLE NULL');
}
}
public function down(): void
{
$driver = DB::getDriverName();
if (in_array($driver, ['mysql', 'mariadb'], true)) {
DB::statement('ALTER TABLE qso_results MODIFY distance_km INT NULL');
}
}
};

View File

@@ -0,0 +1,36 @@
<?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::table('contests', function (Blueprint $table) {
$table->foreignId('rule_set_id')
->nullable()
->constrained('evaluation_rule_sets')
->nullOnDelete();
});
Schema::table('rounds', function (Blueprint $table) {
$table->foreignId('rule_set_id')
->nullable()
->constrained('evaluation_rule_sets')
->nullOnDelete();
});
}
public function down(): void
{
Schema::table('rounds', function (Blueprint $table) {
$table->dropConstrainedForeignId('rule_set_id');
});
Schema::table('contests', function (Blueprint $table) {
$table->dropConstrainedForeignId('rule_set_id');
});
}
};

View File

@@ -0,0 +1,53 @@
<?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::table('evaluation_rule_sets', function (Blueprint $table) {
$table->enum('exchange_type', ['SERIAL', 'WWL', 'SERIAL_WWL', 'CUSTOM'])->default('SERIAL_WWL');
$table->boolean('exchange_requires_wwl')->default(true);
$table->boolean('exchange_requires_serial')->default(true);
$table->boolean('exchange_requires_report')->default(false);
$table->string('exchange_pattern', 200)->nullable();
$table->json('match_tiebreak_order')->nullable();
$table->boolean('match_require_locator_match')->default(false);
$table->boolean('match_require_exchange_match')->default(false);
$table->enum('multiplier_scope', ['PER_BAND', 'OVERALL'])->default('PER_BAND');
$table->enum('multiplier_source', ['VALID_ONLY', 'ALL_MATCHED'])->default('VALID_ONLY');
$table->enum('wwl_multiplier_level', ['LOCATOR_2', 'LOCATOR_4', 'LOCATOR_6'])->default('LOCATOR_6');
$table->boolean('checklog_matching')->default(true);
$table->integer('penalty_out_of_window_points')->default(0);
$table->integer('out_of_window_dq_threshold')->nullable();
});
}
public function down(): void
{
Schema::table('evaluation_rule_sets', function (Blueprint $table) {
$table->dropColumn([
'exchange_type',
'exchange_requires_wwl',
'exchange_requires_serial',
'exchange_requires_report',
'exchange_pattern',
'match_tiebreak_order',
'match_require_locator_match',
'match_require_exchange_match',
'multiplier_scope',
'multiplier_source',
'wwl_multiplier_level',
'checklog_matching',
'penalty_out_of_window_points',
'out_of_window_dq_threshold',
]);
});
}
};

View File

@@ -0,0 +1,28 @@
<?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::table('log_results', function (Blueprint $table) {
$table->integer('base_score')->default(0);
$table->integer('multiplier_count')->default(0);
$table->integer('multiplier_score')->default(0);
});
}
public function down(): void
{
Schema::table('log_results', function (Blueprint $table) {
$table->dropColumn([
'base_score',
'multiplier_count',
'multiplier_score',
]);
});
}
};

View File

@@ -0,0 +1,24 @@
<?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::table('cty', function (Blueprint $table) {
$table->unsignedInteger('dxcc')->nullable()->after('country_name');
$table->index('dxcc');
});
}
public function down(): void
{
Schema::table('cty', function (Blueprint $table) {
$table->dropIndex(['dxcc']);
$table->dropColumn('dxcc');
});
}
};

View File

@@ -0,0 +1,23 @@
<?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::table('qso_results', function (Blueprint $table) {
$table->string('country', 100)->nullable()->after('dxcc');
$table->string('section', 50)->nullable()->after('country');
});
}
public function down(): void
{
Schema::table('qso_results', function (Blueprint $table) {
$table->dropColumn(['country', 'section']);
});
}
};

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('cty', function (Blueprint $table) {
$table->string('prefix_norm', 64)->nullable()->after('prefix');
$table->index('prefix_norm');
});
$driver = DB::getDriverName();
if (in_array($driver, ['mysql', 'mariadb'], true)) {
DB::statement('ALTER TABLE cty MODIFY prefix VARCHAR(64) NOT NULL');
}
}
public function down(): void
{
Schema::table('cty', function (Blueprint $table) {
$table->dropIndex(['prefix_norm']);
$table->dropColumn('prefix_norm');
});
$driver = DB::getDriverName();
if (in_array($driver, ['mysql', 'mariadb'], true)) {
DB::statement('ALTER TABLE cty MODIFY prefix VARCHAR(25) NOT NULL');
}
}
};

View File

@@ -0,0 +1,37 @@
<?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::dropIfExists('rounds_parameters');
}
public function down(): void
{
Schema::create('rounds_parameters', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->unsignedBigInteger('round_id');
$table->enum('log_type', ['STANDARD', 'CHECK']);
$table->boolean('ignore_slash_part')->default(true);
$table->boolean('ignore_third_part')->default(true);
$table->boolean('letters_in_rst')->default(true);
$table->boolean('discard_qso_rec_diff_call')->default(true);
$table->boolean('discard_qso_sent_diff_call')->default(false);
$table->boolean('discard_qso_rec_diff_rst')->default(true);
$table->boolean('discard_qso_sent_diff_rst')->default(false);
$table->boolean('discard_qso_rec_diff_code')->default(true);
$table->boolean('discard_qso_sent_diff_code')->default(false);
$table->boolean('unique_qso')->default(true);
$table->integer('time_tolerance')->default(600);
$table->foreign('round_id')->references('id')->on('rounds')->cascadeOnDelete();
$table->unique(['round_id', 'log_type'], 'rounds_parameters_round_logtype_unique');
});
}
};

View File

@@ -0,0 +1,22 @@
<?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::table('qso_results', function (Blueprint $table) {
$table->integer('penalty_points')->default(0)->after('points');
});
}
public function down(): void
{
Schema::table('qso_results', function (Blueprint $table) {
$table->dropColumn('penalty_points');
});
}
};

View File

@@ -0,0 +1,66 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
$this->dropForeignIfExists('evaluation_rule_sets', 'contest_id');
$this->dropForeignIfExists('evaluation_rule_sets', 'round_id');
Schema::table('evaluation_rule_sets', function (Blueprint $table) {
if (Schema::hasColumn('evaluation_rule_sets', 'contest_id')) {
$table->dropColumn('contest_id');
}
if (Schema::hasColumn('evaluation_rule_sets', 'round_id')) {
$table->dropColumn('round_id');
}
});
}
public function down(): void
{
Schema::table('evaluation_rule_sets', function (Blueprint $table) {
$table->foreignId('contest_id')
->nullable()
->constrained('contests')
->cascadeOnDelete();
$table->foreignId('round_id')
->nullable()
->constrained('rounds')
->cascadeOnDelete();
});
}
private function dropForeignIfExists(string $tableName, string $columnName): void
{
if (! Schema::hasColumn($tableName, $columnName)) {
return;
}
$row = DB::selectOne(
'SELECT CONSTRAINT_NAME as name
FROM information_schema.KEY_COLUMN_USAGE
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = ?
AND COLUMN_NAME = ?
AND REFERENCED_TABLE_NAME IS NOT NULL
LIMIT 1',
[$tableName, $columnName]
);
if (! $row || empty($row->name)) {
return;
}
DB::statement(sprintf(
'ALTER TABLE `%s` DROP FOREIGN KEY `%s`',
$tableName,
$row->name
));
}
};

View File

@@ -0,0 +1,26 @@
<?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::table('evaluation_rule_sets', function (Blueprint $table) {
if (! Schema::hasColumn('evaluation_rule_sets', 'exchange_requires_report')) {
$table->boolean('exchange_requires_report')->default(false);
}
});
}
public function down(): void
{
Schema::table('evaluation_rule_sets', function (Blueprint $table) {
if (Schema::hasColumn('evaluation_rule_sets', 'exchange_requires_report')) {
$table->dropColumn('exchange_requires_report');
}
});
}
};

View File

@@ -0,0 +1,76 @@
<?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::table('evaluation_rule_sets', function (Blueprint $table) {
if (! Schema::hasColumn('evaluation_rule_sets', 'ignore_slash_part')) {
$table->boolean('ignore_slash_part')->default(false);
}
if (! Schema::hasColumn('evaluation_rule_sets', 'ignore_third_part')) {
$table->boolean('ignore_third_part')->default(false);
}
if (! Schema::hasColumn('evaluation_rule_sets', 'letters_in_rst')) {
$table->boolean('letters_in_rst')->default(true);
}
if (! Schema::hasColumn('evaluation_rule_sets', 'discard_qso_rec_diff_call')) {
$table->boolean('discard_qso_rec_diff_call')->default(false);
}
if (! Schema::hasColumn('evaluation_rule_sets', 'discard_qso_sent_diff_call')) {
$table->boolean('discard_qso_sent_diff_call')->default(false);
}
if (! Schema::hasColumn('evaluation_rule_sets', 'discard_qso_rec_diff_rst')) {
$table->boolean('discard_qso_rec_diff_rst')->default(false);
}
if (! Schema::hasColumn('evaluation_rule_sets', 'discard_qso_sent_diff_rst')) {
$table->boolean('discard_qso_sent_diff_rst')->default(false);
}
if (! Schema::hasColumn('evaluation_rule_sets', 'discard_qso_rec_diff_code')) {
$table->boolean('discard_qso_rec_diff_code')->default(false);
}
if (! Schema::hasColumn('evaluation_rule_sets', 'discard_qso_sent_diff_code')) {
$table->boolean('discard_qso_sent_diff_code')->default(false);
}
if (! Schema::hasColumn('evaluation_rule_sets', 'busted_rst_policy')) {
$table->string('busted_rst_policy', 20)->default('ZERO_POINTS');
}
if (! Schema::hasColumn('evaluation_rule_sets', 'penalty_busted_rst_points')) {
$table->integer('penalty_busted_rst_points')->default(0);
}
if (! Schema::hasColumn('evaluation_rule_sets', 'out_of_window_dq_threshold')) {
$table->integer('out_of_window_dq_threshold')->nullable();
}
});
}
public function down(): void
{
Schema::table('evaluation_rule_sets', function (Blueprint $table) {
$columns = [
'ignore_slash_part',
'ignore_third_part',
'letters_in_rst',
'discard_qso_rec_diff_call',
'discard_qso_sent_diff_call',
'discard_qso_rec_diff_rst',
'discard_qso_sent_diff_rst',
'discard_qso_rec_diff_code',
'discard_qso_sent_diff_code',
'busted_rst_policy',
'penalty_busted_rst_points',
'out_of_window_dq_threshold',
];
foreach ($columns as $column) {
if (Schema::hasColumn('evaluation_rule_sets', $column)) {
$table->dropColumn($column);
}
}
});
}
};

View File

@@ -0,0 +1,36 @@
<?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::table('evaluation_rule_sets', function (Blueprint $table) {
if (! Schema::hasColumn('evaluation_rule_sets', 'time_diff_dq_threshold_percent')) {
$table->integer('time_diff_dq_threshold_percent')->nullable();
}
if (! Schema::hasColumn('evaluation_rule_sets', 'time_diff_dq_threshold_sec')) {
$table->integer('time_diff_dq_threshold_sec')->nullable();
}
});
}
public function down(): void
{
Schema::table('evaluation_rule_sets', function (Blueprint $table) {
$columns = [
'time_diff_dq_threshold_percent',
'time_diff_dq_threshold_sec',
];
foreach ($columns as $column) {
if (Schema::hasColumn('evaluation_rule_sets', $column)) {
$table->dropColumn($column);
}
}
});
}
};

View File

@@ -0,0 +1,26 @@
<?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::table('qso_results', function (Blueprint $table) {
if (! Schema::hasColumn('qso_results', 'time_diff_sec')) {
$table->integer('time_diff_sec')->nullable()->after('distance_km');
}
});
}
public function down(): void
{
Schema::table('qso_results', function (Blueprint $table) {
if (Schema::hasColumn('qso_results', 'time_diff_sec')) {
$table->dropColumn('time_diff_sec');
}
});
}
};

View File

@@ -0,0 +1,26 @@
<?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::table('evaluation_rule_sets', function (Blueprint $table) {
if (! Schema::hasColumn('evaluation_rule_sets', 'bad_qso_dq_threshold_percent')) {
$table->integer('bad_qso_dq_threshold_percent')->nullable();
}
});
}
public function down(): void
{
Schema::table('evaluation_rule_sets', function (Blueprint $table) {
if (Schema::hasColumn('evaluation_rule_sets', 'bad_qso_dq_threshold_percent')) {
$table->dropColumn('bad_qso_dq_threshold_percent');
}
});
}
};

View File

@@ -0,0 +1,53 @@
<?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::table('rounds', function (Blueprint $table) {
if (! Schema::hasColumn('rounds', 'preliminary_evaluation_run_id')) {
$table->foreignId('preliminary_evaluation_run_id')
->nullable()
->after('rule_set_id')
->constrained('evaluation_runs')
->nullOnDelete();
}
if (! Schema::hasColumn('rounds', 'official_evaluation_run_id')) {
$table->foreignId('official_evaluation_run_id')
->nullable()
->after('preliminary_evaluation_run_id')
->constrained('evaluation_runs')
->nullOnDelete();
}
if (! Schema::hasColumn('rounds', 'test_evaluation_run_id')) {
$table->foreignId('test_evaluation_run_id')
->nullable()
->after('official_evaluation_run_id')
->constrained('evaluation_runs')
->nullOnDelete();
}
});
}
public function down(): void
{
Schema::table('rounds', function (Blueprint $table) {
if (Schema::hasColumn('rounds', 'test_evaluation_run_id')) {
$table->dropForeign(['test_evaluation_run_id']);
$table->dropColumn('test_evaluation_run_id');
}
if (Schema::hasColumn('rounds', 'official_evaluation_run_id')) {
$table->dropForeign(['official_evaluation_run_id']);
$table->dropColumn('official_evaluation_run_id');
}
if (Schema::hasColumn('rounds', 'preliminary_evaluation_run_id')) {
$table->dropForeign(['preliminary_evaluation_run_id']);
$table->dropColumn('preliminary_evaluation_run_id');
}
});
}
};

View File

@@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('evaluation_rule_sets', function (Blueprint $table) {
$table->boolean('rst_ignore_third_char')->default(false)->after('letters_in_rst');
$table->unsignedInteger('callsign_suffix_max_len')->nullable()->after('callsign_normalization');
$table->unsignedInteger('callsign_levenshtein_max')->nullable()->after('callsign_suffix_max_len');
$table->boolean('allow_time_shift_one_hour')->default(false)->after('time_tolerance_sec');
$table->unsignedInteger('time_shift_seconds')->nullable()->after('allow_time_shift_one_hour');
$table->string('time_mismatch_policy', 20)->nullable()->after('time_shift_seconds');
$table->boolean('discard_qso_rec_diff_serial')->nullable()->after('discard_qso_rec_diff_code');
$table->boolean('discard_qso_sent_diff_serial')->nullable()->after('discard_qso_sent_diff_code');
$table->boolean('discard_qso_rec_diff_wwl')->nullable()->after('discard_qso_sent_diff_serial');
$table->boolean('discard_qso_sent_diff_wwl')->nullable()->after('discard_qso_rec_diff_wwl');
});
DB::statement('UPDATE evaluation_rule_sets SET rst_ignore_third_char = ignore_third_part WHERE rst_ignore_third_char = 0');
DB::statement('UPDATE evaluation_rule_sets SET discard_qso_rec_diff_serial = discard_qso_rec_diff_code WHERE discard_qso_rec_diff_serial IS NULL');
DB::statement('UPDATE evaluation_rule_sets SET discard_qso_sent_diff_serial = discard_qso_sent_diff_code WHERE discard_qso_sent_diff_serial IS NULL');
DB::statement('UPDATE evaluation_rule_sets SET discard_qso_rec_diff_wwl = discard_qso_rec_diff_code WHERE discard_qso_rec_diff_wwl IS NULL');
DB::statement('UPDATE evaluation_rule_sets SET discard_qso_sent_diff_wwl = discard_qso_sent_diff_code WHERE discard_qso_sent_diff_wwl IS NULL');
}
public function down(): void
{
Schema::table('evaluation_rule_sets', function (Blueprint $table) {
$table->dropColumn([
'rst_ignore_third_char',
'callsign_suffix_max_len',
'callsign_levenshtein_max',
'allow_time_shift_one_hour',
'time_shift_seconds',
'time_mismatch_policy',
'discard_qso_rec_diff_serial',
'discard_qso_sent_diff_serial',
'discard_qso_rec_diff_wwl',
'discard_qso_sent_diff_wwl',
]);
});
}
};

View File

@@ -0,0 +1,23 @@
<?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::table('qso_results', function (Blueprint $table) {
$table->string('match_type', 40)->nullable()->after('matched_qso_id');
$table->json('error_flags')->nullable()->after('error_detail');
});
}
public function down(): void
{
Schema::table('qso_results', function (Blueprint $table) {
$table->dropColumn(['match_type', 'error_flags']);
});
}
};

View File

@@ -0,0 +1,38 @@
<?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::table('evaluation_rule_sets', function (Blueprint $table) {
if (! Schema::hasColumn('evaluation_rule_sets', 'allow_time_mismatch_pairing')) {
$table->boolean('allow_time_mismatch_pairing')->default(true)->after('time_tolerance_sec');
}
if (! Schema::hasColumn('evaluation_rule_sets', 'time_mismatch_max_sec')) {
$table->unsignedInteger('time_mismatch_max_sec')->nullable()->after('allow_time_mismatch_pairing');
}
if (! Schema::hasColumn('evaluation_rule_sets', 'dup_resolution_strategy')) {
$table->json('dup_resolution_strategy')->nullable()->after('require_unique_qso');
}
});
}
public function down(): void
{
Schema::table('evaluation_rule_sets', function (Blueprint $table) {
if (Schema::hasColumn('evaluation_rule_sets', 'allow_time_mismatch_pairing')) {
$table->dropColumn('allow_time_mismatch_pairing');
}
if (Schema::hasColumn('evaluation_rule_sets', 'time_mismatch_max_sec')) {
$table->dropColumn('time_mismatch_max_sec');
}
if (Schema::hasColumn('evaluation_rule_sets', 'dup_resolution_strategy')) {
$table->dropColumn('dup_resolution_strategy');
}
});
}
};

View File

@@ -0,0 +1,38 @@
<?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::table('qso_results', function (Blueprint $table) {
if (! Schema::hasColumn('qso_results', 'matched_log_qso_id')) {
$table->unsignedBigInteger('matched_log_qso_id')->nullable()->after('matched_qso_id');
}
if (! Schema::hasColumn('qso_results', 'match_confidence')) {
$table->string('match_confidence', 20)->nullable()->after('matched_log_qso_id');
}
if (! Schema::hasColumn('qso_results', 'error_side')) {
$table->string('error_side', 10)->nullable()->after('error_code');
}
});
}
public function down(): void
{
Schema::table('qso_results', function (Blueprint $table) {
if (Schema::hasColumn('qso_results', 'matched_log_qso_id')) {
$table->dropColumn('matched_log_qso_id');
}
if (Schema::hasColumn('qso_results', 'match_confidence')) {
$table->dropColumn('match_confidence');
}
if (Schema::hasColumn('qso_results', 'error_side')) {
$table->dropColumn('error_side');
}
});
}
};

View File

@@ -0,0 +1,62 @@
<?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::table('evaluation_rule_sets', function (Blueprint $table) {
if (! Schema::hasColumn('evaluation_rule_sets', 'no_counterpart_log_policy')) {
$table->string('no_counterpart_log_policy', 30)->default('PENALTY')->after('nil_qso_policy');
}
if (! Schema::hasColumn('evaluation_rule_sets', 'not_in_counterpart_log_policy')) {
$table->string('not_in_counterpart_log_policy', 30)->default('PENALTY')->after('no_counterpart_log_policy');
}
if (! Schema::hasColumn('evaluation_rule_sets', 'unique_qso_policy')) {
$table->string('unique_qso_policy', 30)->default('ZERO_POINTS')->after('not_in_counterpart_log_policy');
}
if (! Schema::hasColumn('evaluation_rule_sets', 'busted_serial_policy')) {
$table->string('busted_serial_policy', 30)->default('ZERO_POINTS')->after('busted_rst_policy');
}
if (! Schema::hasColumn('evaluation_rule_sets', 'penalty_busted_serial_points')) {
$table->integer('penalty_busted_serial_points')->default(0)->after('busted_serial_policy');
}
if (! Schema::hasColumn('evaluation_rule_sets', 'busted_locator_policy')) {
$table->string('busted_locator_policy', 30)->default('ZERO_POINTS')->after('penalty_busted_serial_points');
}
if (! Schema::hasColumn('evaluation_rule_sets', 'penalty_busted_locator_points')) {
$table->integer('penalty_busted_locator_points')->default(0)->after('busted_locator_policy');
}
});
}
public function down(): void
{
Schema::table('evaluation_rule_sets', function (Blueprint $table) {
if (Schema::hasColumn('evaluation_rule_sets', 'penalty_busted_locator_points')) {
$table->dropColumn('penalty_busted_locator_points');
}
if (Schema::hasColumn('evaluation_rule_sets', 'busted_locator_policy')) {
$table->dropColumn('busted_locator_policy');
}
if (Schema::hasColumn('evaluation_rule_sets', 'penalty_busted_serial_points')) {
$table->dropColumn('penalty_busted_serial_points');
}
if (Schema::hasColumn('evaluation_rule_sets', 'busted_serial_policy')) {
$table->dropColumn('busted_serial_policy');
}
if (Schema::hasColumn('evaluation_rule_sets', 'unique_qso_policy')) {
$table->dropColumn('unique_qso_policy');
}
if (Schema::hasColumn('evaluation_rule_sets', 'not_in_counterpart_log_policy')) {
$table->dropColumn('not_in_counterpart_log_policy');
}
if (Schema::hasColumn('evaluation_rule_sets', 'no_counterpart_log_policy')) {
$table->dropColumn('no_counterpart_log_policy');
}
});
}
};

View File

@@ -0,0 +1,34 @@
<?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::table('log_results', function (Blueprint $table) {
$table->integer('total_qso_count')->default(0);
$table->integer('discarded_qso_count')->default(0);
$table->integer('discarded_points')->default(0);
$table->decimal('discarded_qso_percent', 5, 2)->default(0);
$table->integer('unique_qso_count')->default(0);
$table->decimal('score_per_qso', 10, 2)->nullable();
});
}
public function down(): void
{
Schema::table('log_results', function (Blueprint $table) {
$table->dropColumn([
'total_qso_count',
'discarded_qso_count',
'discarded_points',
'discarded_qso_percent',
'unique_qso_count',
'score_per_qso',
]);
});
}
};

View File

@@ -0,0 +1,23 @@
<?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::table('users', function (Blueprint $table) {
$table->boolean('is_active')->default(true)->index();
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropIndex(['is_active']);
$table->dropColumn('is_active');
});
}
};

View File

@@ -0,0 +1,27 @@
<?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::table('evaluation_rule_sets', function (Blueprint $table) {
$table->enum('operating_window_mode', ['NONE', 'BEST_CONTIGUOUS'])
->default('NONE')
->after('dup_resolution_strategy');
$table->unsignedTinyInteger('operating_window_hours')
->nullable()
->after('operating_window_mode');
});
}
public function down(): void
{
Schema::table('evaluation_rule_sets', function (Blueprint $table) {
$table->dropColumn(['operating_window_mode', 'operating_window_hours']);
});
}
};

View File

@@ -0,0 +1,30 @@
<?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::table('log_results', function (Blueprint $table) {
$table->dateTime('operating_window_start_utc')->nullable()->after('sixhr_category');
$table->dateTime('operating_window_end_utc')->nullable()->after('operating_window_start_utc');
$table->unsignedTinyInteger('operating_window_hours')->nullable()->after('operating_window_end_utc');
$table->unsignedInteger('operating_window_qso_count')->nullable()->after('operating_window_hours');
});
}
public function down(): void
{
Schema::table('log_results', function (Blueprint $table) {
$table->dropColumn([
'operating_window_start_utc',
'operating_window_end_utc',
'operating_window_hours',
'operating_window_qso_count',
]);
});
}
};

View File

@@ -0,0 +1,24 @@
<?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::table('qso_results', function (Blueprint $table) {
$table->boolean('is_operating_window_excluded')
->default(false)
->after('is_time_out_of_window');
});
}
public function down(): void
{
Schema::table('qso_results', function (Blueprint $table) {
$table->dropColumn('is_operating_window_excluded');
});
}
};

View File

@@ -0,0 +1,24 @@
<?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::table('evaluation_rule_sets', function (Blueprint $table) {
$table->string('sixhr_ranking_mode', 10)
->default('IARU')
->after('operating_window_hours');
});
}
public function down(): void
{
Schema::table('evaluation_rule_sets', function (Blueprint $table) {
$table->dropColumn('sixhr_ranking_mode');
});
}
};

View File

@@ -0,0 +1,22 @@
<?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::table('log_results', function (Blueprint $table) {
$table->string('sixhr_ranking_bucket', 10)->nullable()->after('sixhr_category');
});
}
public function down(): void
{
Schema::table('log_results', function (Blueprint $table) {
$table->dropColumn('sixhr_ranking_bucket');
});
}
};

View File

@@ -0,0 +1,30 @@
<?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::table('log_results', function (Blueprint $table) {
$table->dateTime('operating_window_2_start_utc')
->nullable()
->after('operating_window_end_utc');
$table->dateTime('operating_window_2_end_utc')
->nullable()
->after('operating_window_2_start_utc');
});
}
public function down(): void
{
Schema::table('log_results', function (Blueprint $table) {
$table->dropColumn([
'operating_window_2_start_utc',
'operating_window_2_end_utc',
]);
});
}
};