<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('contrats', function (Blueprint $table) {
            $table->id();
            $table->string('codeContrat')->nullable();
            $table->string('debutContrat')->nullable();
            $table->string('dureeContrat')->nullable();
            $table->string('montantTotal')->nullable();
            $table->bigInteger('typeContrat_id')->unsigned()->nullable();
            $table->foreign('typeContrat_id')->references('id')->on('type_contrats')->nullable();
            $table->bigInteger('client_id')->unsigned()->nullable();
            $table->foreign('client_id')->references('id')->on('clients')->nullable();
            $table->bigInteger('unite_id')->unsigned()->nullable();
            $table->foreign('unite_id')->references('id')->on('unites')->nullable();
            $table->timestamps();
        });
    }

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