<?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('duas', function (Blueprint $table) {
            $table->engine = 'InnoDB'; // Explicitly set the engine
            $table->id();
            $table->string('title');
            $table->text('translation');
            $table->text('description')->nullable();
            $table->string('image')->nullable();
            $table->unsignedBigInteger('dua_category_id'); // Ensure this matches the referenced column
            $table->foreign('dua_category_id')->references('id')->on('dua_categories')->onDelete('cascade');
            $table->timestamps();
        });
    }

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