<?php

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

class CreateEtablissementsTable extends Migration
{
    public function up()
    {
        Schema::create('etablissements', function (Blueprint $table) {
            $table->id();
            $table->string('nom');
            $table->string('intitule')->nullable();
            $table->unsignedBigInteger('universite_id')->nullable();
            $table->timestamps();

            $table->foreign('universite_id')->references('id')->on('universites')->onDelete('set null');
        });
    }

    public function down()
    {
        Schema::dropIfExists('etablissements');
    }
}
