<?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
    {
        // The shamsi month a student joined — used to flag "new" (VIP) students
        // and to only evaluate students who were enrolled by the eval month.
        Schema::table('students', function (Blueprint $table) {
            $table->unsignedTinyInteger('enrollment_month_shamsi')->nullable()->after('academic_year');
        });

        // A cached per-evaluation class average so lists render fast.
        Schema::table('evaluations', function (Blueprint $table) {
            $table->decimal('class_avg', 5, 2)->nullable()->after('status');
        });
    }

    public function down(): void
    {
        Schema::table('students', fn (Blueprint $t) => $t->dropColumn('enrollment_month_shamsi'));
        Schema::table('evaluations', fn (Blueprint $t) => $t->dropColumn('class_avg'));
    }
};
