<?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('niveaux', function (Blueprint $table) {
            $table->id();
            $table-> string('libelle');
            $table->unsignedBigInteger('reforme_id');
            $table->foreign('reforme_id')->references('id')->on('reformes')
            ->constrained()
            ->onUpdate('restrict')
            ->onDelete('restrict'); 
            $table->unsignedBigInteger('cycle_id');
            $table->foreign('cycle_id')->references('id')->on('cycles')
            ->constrained()
            ->onUpdate('restrict')
            ->onDelete('restrict'); 
            $table-> Integer('ordre');
            $table->timestamps();
        });
    }

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