Migration to add bonus score related columns to the total scores table.
This commit is contained in:
parent
6c52aa255c
commit
ee45499e7a
|
|
@ -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::table('entry_total_scores', function (Blueprint $table) {
|
||||||
|
$table->decimal('bonus_total', 9, 6)->nullable()->after('advancement_subscore_totals');
|
||||||
|
$table->decimal('seating_total_with_bonus', 9, 6)
|
||||||
|
->storedAs('seating_total + COALESCE(bonus_total, 0)')
|
||||||
|
->after('bonus_total');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('entry_total_scores', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('bonus_total');
|
||||||
|
$table->dropColumn('seating_total_with_bonus');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue