<?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('projects', function (Blueprint $table) {
            $table->id();
            $table->string('libelle');
            $table->string('sonStyle')->nullable();
            $table->boolean('isOffline');
            $table->timestamps();                        
            $table->unsignedBigInteger('application_id')->nullable();

            $table->foreign('application_id')->references('id')->on('applications')->onDelete('cascade');
        });
    }

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

        Schema::dropIfExists('answers');
        Schema::dropIfExists('questions');
        Schema::dropIfExists('quiz_questions');
        Schema::dropIfExists('exercises');
        Schema::dropIfExists('chapters');
        Schema::dropIfExists('documents');
        Schema::dropIfExists('categories');
        //doit est supprimer en haut

        Schema::dropIfExists('projects');
        Schema::dropIfExists('applications');


    }
};
