<?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::create('ouvrage_livres', function (Blueprint $table) {
            $table->id();
            $table->string('titre');
            $table->string('langue');
            $table->integer('nbre_page');
            $table->integer('quantite');
            $table->float('prix');
            $table->unsignedBigInteger('categorie_id');
            $table->date('date_reception');
            $table->timestamps();
            $table->boolean('status')->default(true);
            $table->foreign('categorie_id')->references('id')->on('categorie_ouvrages')->cascadeOnDelete();
        });
    }

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