<?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('jawaban_kuesioners', function (Blueprint $table) {
            $table->id();
            $table->integer('siswa_id')->unsigned();
            $table->foreignId('pertanyaan_id')->constrained('pertanyaan_kuesioners')->onDelete('cascade');
            $table->tinyInteger('nilai'); // 1–5
            $table->integer('minggu_ke');
            $table->integer('tahun');
            $table->date('tanggal_isi');
            $table->foreign('siswa_id')->references('id_siswa')->on('siswas')->onDelete('cascade')->onUpdate('cascade');
            $table->timestamps();
        });
    }

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