<?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::disableForeignKeyConstraints(); 
        Schema::create('professeurs', function (Blueprint $table) {
            $table->id();
           
            $table->string('nomar');
            $table->string('nomfr');
            $table->string('matricule');
            $table->string('nni');
            $table->Date('date_naissance');
            $table->Date('date_recritement');
            $table->string('lieu_naissance_ar');
            $table->string('lieu_naissance_fr');
            $table->string('discipline_origine');
            $table->string('contact');
            $table->unsignedBigInteger('statut_id');
            $table->foreign('statut_id')->references('id')->on('statuts')
            ->constrained()
            ->onUpdate('restrict')
            ->onDelete('restrict'); 
            $table->unsignedBigInteger('cycle_id');
            $table->foreign('cycle_id')->references('id')->on('cycles')
            ->constrained()
            ->onUpdate('restrict')
            ->onDelete('restrict'); 
           /* $table->unsignedBigInteger('discipline_id');
            $table->foreign('discipline_id')->references('id')->on('disciplines')
            ->constrained()
            ->onUpdate('restrict')
            ->onDelete('restrict'); */
            $table->string('photo');
            $table->timestamps();
        });
    }

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