<?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('soal_challenge', function (Blueprint $table) {
    $table->id('id_soal');
    $table->unsignedBigInteger('id_challenge');
    $table->text('pertanyaan');
    $table->string('opsi_a');
    $table->string('opsi_b');
    $table->string('opsi_c');
    $table->string('opsi_d');
    $table->enum('jawaban_benar', ['A','B','C','D']);
    $table->integer('exp_per_soal')->default(0);
    $table->timestamps();

    $table->foreign('id_challenge')
          ->references('id_challenge')
          ->on('challenges')
          ->onDelete('cascade');
});

    }

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