<?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('inspecteurs', function (Blueprint $table) {
            $table->id();
  
            $table->string('nomfr');
            $table->string('nomar');
            $table->string('matricule');
            $table->string('nni');
            $table->date('date_naissance');
            $table->string('lieu_naissance_ar');
            $table->string('lieu_naissance_fr');
            
            $table->date('date_affectation');
            $table->string('contact');
            $table->date('date_mise_en_corps_IES');
       
            $table->string('bank');
            $table->string('compte');
            $table->string('email');
            $table->string('matrimonialite');
            $table->date('date_recri_fp');
            $table->string('photo');
            $table->unsignedBigInteger('discipline_id');
            $table->foreign('discipline_id')->references('id')->on('disciplines')
            ->constrained()
            ->onUpdate('restrict')
            ->onDelete('restrict'); 
            $table->unsignedBigInteger('pole_id');
            $table->foreign('pole_id')->references('id')->on('poles')
            ->constrained()
            ->onUpdate('restrict')
            ->onDelete('restrict'); 

            $table->timestamps();
        });
    }

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