<?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('gen_moyennes_tables', function (Blueprint $table) {
            $table->id(); // Primary key for Moyenne Globale
            $table->foreignId('eleve_id')->constrained('eleves')->onDelete('cascade'); // Foreign key to Eleves table
            $table->decimal('moyenne', 5, 2); // Average score
            $table->integer('rank'); // Rank of the student
            $table->timestamps(); // Timestamps for Moyenne Globale

        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('gen_moyennes_tables');
    }
};
