Remove depricated table and create total_scores table

This commit is contained in:
Matt Young 2025-06-11 23:03:49 -05:00
parent 58f29f326c
commit 9331e61839
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,31 @@
<?php
use App\Models\Entry;
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::dropIfExists('calculated_scores');
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::create('calculated_scores', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(Entry::class)->constrained()->cascadeOnDelete()->cascadeOnUpdate();
$table->string('mode');
$table->json('calculatedScore');
$table->timestamps();
});
}
};

View File

@ -0,0 +1,32 @@
<?php
use App\Models\Entry;
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('total_scores', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(Entry::class)->constrained()->cascadeOnDelete()->cascadeOnUpdate();
$table->decimal('seating_total', 9, 6)->after('subscores');
$table->decimal('advancement_total', 9, 6)->after('seating_total');
$table->json('subscore_totals');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('total_scores');
}
};