<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCategorieAnnonceTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('categorie_annonce', function (Blueprint $table) {
            $table->charset = 'utf8mb4';
            $table->collation = 'utf8mb4_general_ci';

            $table->id();
            $table->string('libelle')->unique();
            // Désigne si les éléments de cette catégorie sont prioritaires
            $table->boolean('is_prio')->default(0);
            // Une categorie peut avoir des sous catégories
           // $table->foreignId('parent_id')->nullable()->constrained('categorie_annonce');
            //$table->unsignedBigInteger('parent_id')->nullable();
            $table->timestamps();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('categorie_annonce');
    }
}
